|
|
@ -793,7 +793,10 @@ class GamesService
|
|
|
|
# 如果没有超时并且正在评测中
|
|
|
|
# 如果没有超时并且正在评测中
|
|
|
|
# 判断评测中的状态有两种:1、如果之前没有通关的,只需判断status为1即可;如果通过关,则判断game的resubmit_identifier是否更新
|
|
|
|
# 判断评测中的状态有两种:1、如果之前没有通关的,只需判断status为1即可;如果通过关,则判断game的resubmit_identifier是否更新
|
|
|
|
if (params[:time_out] == "false") && ((params[:resubmit].blank? && game.status==1) || (params[:resubmit].present? && (params[:resubmit] != resubmit_identifier)))
|
|
|
|
if (params[:time_out] == "false") && ((params[:resubmit].blank? && game.status==1) || (params[:resubmit].present? && (params[:resubmit] != resubmit_identifier)))
|
|
|
|
return
|
|
|
|
# 代码评测的信息
|
|
|
|
|
|
|
|
running_code_status = game.run_code_message.try(:status)
|
|
|
|
|
|
|
|
running_code_message = game.run_code_message.try(:message)
|
|
|
|
|
|
|
|
return {:running_code_status => running_code_status, :running_code_message => running_code_message}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
Rails.logger.info("##### resubmit_identifier is #{resubmit_identifier}")
|
|
|
|
Rails.logger.info("##### resubmit_identifier is #{resubmit_identifier}")
|
|
|
@ -887,15 +890,10 @@ class GamesService
|
|
|
|
|
|
|
|
|
|
|
|
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}
|
|
|
|
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}
|
|
|
|
|
|
|
|
|
|
|
|
# 代码评测的信息
|
|
|
|
|
|
|
|
running_code_status = game.run_code_message.try(:status)
|
|
|
|
|
|
|
|
running_code_message = game.run_code_message.try(:message)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return {:grade => grade, :gold => score, :experience => experience, :status => game_status, :had_done => had_done,
|
|
|
|
return {:grade => grade, :gold => score, :experience => experience, :status => game_status, :had_done => had_done,
|
|
|
|
:position => game_challenge.position, :port => port, :power => power, :record => record,
|
|
|
|
:position => game_challenge.position, :port => port, :power => power, :record => record,
|
|
|
|
:mirror_name => mirror_name, :picture => picture, :web_route => web_route, :latest_output => latest_output,
|
|
|
|
:mirror_name => mirror_name, :picture => picture, :web_route => web_route, :latest_output => latest_output,
|
|
|
|
:star => game.star, :next_game => next_game, :prev_game => prev_game,
|
|
|
|
:star => game.star, :next_game => next_game, :prev_game => prev_game}.merge(output_hash)
|
|
|
|
:running_code_status => running_code_status, :running_code_message => running_code_message}.merge(output_hash)
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
# 记录实训花费的时间,前端是通过ent_time - open_time,所以最终只更新open_time即可
|
|
|
|
# 记录实训花费的时间,前端是通过ent_time - open_time,所以最终只更新open_time即可
|
|
|
|