|
|
|
@ -741,14 +741,14 @@ class GamesController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
else # 重新评测
|
|
|
|
|
# 如果满足前面的条件,进入此处只可能是结果已返回并存入了数据库
|
|
|
|
|
if params[:resubmit] == resubmit_identifier # 本次重新评测结果已经返回并存入数据库
|
|
|
|
|
if params[:resubmit] == resubmit_identifier # 本次重新评测结果已经返回并存入数据库
|
|
|
|
|
game_status = (@game.retry_status == 2 ? 2 : 0) # retry_status是判断重新评测的通关情况。2表示通关
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# 实训的最大评测次数,这个值是为了优化查询,每次只取最新的最新一次评测的结果集
|
|
|
|
|
max_query_index = @game.query_index
|
|
|
|
|
#max_query_index = @game.outputs.first.try(:query_index)
|
|
|
|
|
# max_query_index = @game.outputs.first.try(:query_index)
|
|
|
|
|
# 区分评测过未评测过,未评测过按需求取数据
|
|
|
|
|
testset_detail max_query_index.to_i, game_challenge
|
|
|
|
|
|
|
|
|
@ -758,9 +758,10 @@ class GamesController < ApplicationController
|
|
|
|
|
web_route = game_challenge.try(:web_route)
|
|
|
|
|
mirror_name = @shixun.mirror_name
|
|
|
|
|
|
|
|
|
|
e_record = EvaluateRecord.where(:sec_key => sec_key).first
|
|
|
|
|
# 轮询结束,更新评测统计耗时
|
|
|
|
|
if game_status == 0 || game_status == 2
|
|
|
|
|
e_record = EvaluateRecord.where(:sec_key => sec_key).first
|
|
|
|
|
|
|
|
|
|
if e_record
|
|
|
|
|
front_js = format("%.3f", (Time.now.to_f - e_record.try(:updated_at).to_f)).to_f
|
|
|
|
|
consume_time = format("%.3f", (Time.now - e_record.created_at)).to_f
|
|
|
|
@ -770,7 +771,8 @@ class GamesController < ApplicationController
|
|
|
|
|
|
|
|
|
|
uid_logger("game is #{@game.id}, record id is #{e_record.try(:id)}, time is**** #{Time.now.strftime("%Y-%m-%d %H:%M:%S.%L")}")
|
|
|
|
|
# 记录前端总耗时
|
|
|
|
|
record_consume_time = EvaluateRecord.where(:game_id => @game.id).first.try(:consume_time)
|
|
|
|
|
record_consume_time = e_record.try(:pod_execute)
|
|
|
|
|
max_mem = e_record.try(:max_mem)
|
|
|
|
|
# 实训制作者当前拥有的金币
|
|
|
|
|
grade = User.where(:id => @game.user_id).pluck(:grade).first
|
|
|
|
|
|
|
|
|
@ -781,7 +783,7 @@ class GamesController < ApplicationController
|
|
|
|
|
@base_date = {grade: grade, gold: score, experience: experience, status: game_status, had_done: had_done,
|
|
|
|
|
position: game_challenge.position, port: port, record_consume_time: record_consume_time,
|
|
|
|
|
mirror_name: mirror_name, picture: picture, web_route: web_route, star: @game.star,
|
|
|
|
|
next_game: next_game, prev_game: prev_game}
|
|
|
|
|
next_game: next_game, prev_game: prev_game, max_mem: max_mem}
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# 记录实训花费的时间
|
|
|
|
|