diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index 769481b0..e3ecc2ce 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -853,7 +853,7 @@ class ManagementsController < ApplicationController def evaluate_simple page = params[:page] - @recodes = EvaluateRecord.where("created_at > ?", Time.now - 1.days).reorder("consume_time desc") + @recodes = EvaluateRecord.where("created_at > ?", Time.now - 0.5.days).reorder("consume_time desc") @recodes_count = @recodes.size @record_pages = Paginator.new @recodes_count, 20, page || 1 @offset ||= @record_pages.offset diff --git a/app/services/games_service.rb b/app/services/games_service.rb index 2139715e..e413c101 100644 --- a/app/services/games_service.rb +++ b/app/services/games_service.rb @@ -371,7 +371,8 @@ class GamesService end if content != last_content content_modified = 1 - code_file = @g.edit_file(@myshixun.gpid, current_user.login, :content => content, :file_path => path, :branch_name => "master", :commit_message => "auto commit") + code_file = @g.edit_file(@myshixun.gpid, current_user.login, :content => content, :file_path => path, :branch_name => "master", + :commit_message => (params[:evaluate] == 1 ? "commit by author" : "auto commit" )) end # REDO:是否有读写分离的问题 if record.present? @@ -801,6 +802,7 @@ class GamesService # 轮询获取状态 # resubmit是在file_update中生成的,从game_build中传入的 def game_status params, current_user + Rails.logger.info("sec_key is #{params[:sec_key]}**1") game = Game.find_by_identifier(params[:identifier]) resubmit_identifier = game.resubmit_identifier # 如果没有超时并且正在评测中 @@ -812,6 +814,7 @@ class GamesService return {:running_code_status => running_code_status, :running_code_message => running_code_message} end + Rails.logger.info("sec_key is #{params[:sec_key]}**2") Rails.logger.info("##### resubmit_identifier is #{resubmit_identifier}") port = params[:port] score = 0 @@ -838,6 +841,7 @@ class GamesService end end + Rails.logger.info("sec_key is #{params[:sec_key]}**3") # 实训的最大评测次数,这个值是为了优化查询,每次只取最新的最新一次评测的结果集 max_query_index = game.query_index - 1 # 区分评测过未评测过,未评测过按需求取数据 @@ -854,7 +858,7 @@ class GamesService # 能进入到此处,肯定是已经返回了结果,也就是说outputs中肯定有了数据 - + Rails.logger.info("sec_key is #{params[:sec_key]}**4") test_sets_count = qurey_test_sets.size # had_test = Output.where(:game_id => game.id, :query_index => max_query_index) # had_test_count = had_test.count @@ -881,6 +885,7 @@ class GamesService web_route = game_challenge.try(:web_route) mirror_name = shixun.mirror_name + Rails.logger.info("sec_key is #{params[:sec_key]}**5") # 轮询结束,更新评测耗时 e_record = EvaluateRecord.where(:identifier => params[:sec_key]).first if game_status == 0 || game_status == 2 @@ -898,12 +903,14 @@ class GamesService # 实训制作者当前拥有的金币 grade = User.where(:id => game.user_id).pluck(:grade).first + Rails.logger.info("sec_key is #{params[:sec_key]}**6") # 高性能取上一关、下一关 prev_game = Game.prev_identifier(shixun.id, game.myshixun_id, game_challenge.position) next_game = Game.next_game(shixun.id, game.myshixun_id, game_challenge.position).try(:identifier) output_hash = {:test_sets => test_sets, :had_test_count => test_sets_count, :test_sets_count => test_sets_count, :had_passed_testsests_error_count => had_passed_testsests_error_count} + Rails.logger.info("sec_key is #{params[:sec_key]}**7") return {:grade => grade, :gold => score, :experience => experience, :status => game_status, :had_done => had_done, :position => game_challenge.position, :port => port, :power => power, :record => record, :mirror_name => mirror_name, :picture => picture, :web_route => web_route, :latest_output => latest_output, diff --git a/app/views/shixuns/_settings_show.html.erb b/app/views/shixuns/_settings_show.html.erb index 92417f49..72752703 100644 --- a/app/views/shixuns/_settings_show.html.erb +++ b/app/views/shixuns/_settings_show.html.erb @@ -1,3 +1,4 @@ +
配置 diff --git a/db/migrate/20190525060616_modify_exec_time_for_shixun.rb b/db/migrate/20190525060616_modify_exec_time_for_shixun.rb new file mode 100644 index 00000000..a5602ca8 --- /dev/null +++ b/db/migrate/20190525060616_modify_exec_time_for_shixun.rb @@ -0,0 +1,8 @@ +class ModifyExecTimeForShixun < ActiveRecord::Migration + def up + change_column(:shixuns, :exec_time, :integer, :default => 20) + end + + def down + end +end