|
|
|
@ -712,6 +712,7 @@ class GamesController < ApplicationController
|
|
|
|
|
uid_logger("################params[:resubmit]: #{params[:resubmit]}")
|
|
|
|
|
uid_logger("################resubmit_identifier: #{resubmit_identifier}")
|
|
|
|
|
uid_logger("################time_out: #{params[:time_out]}")
|
|
|
|
|
sec_key = params[:sec_key]
|
|
|
|
|
if (params[:time_out] == "false") && ((params[:resubmit].blank? && @game.status == 1) || (params[:resubmit].present? &&
|
|
|
|
|
(params[:resubmit] != resubmit_identifier)))
|
|
|
|
|
# 代码评测的信息
|
|
|
|
@ -759,7 +760,7 @@ class GamesController < ApplicationController
|
|
|
|
|
|
|
|
|
|
# 轮询结束,更新评测统计耗时
|
|
|
|
|
if game_status == 0 || game_status == 2
|
|
|
|
|
e_record = EvaluateRecord.where(:game_id => @game.id).first
|
|
|
|
|
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
|
|
|
|
@ -767,7 +768,7 @@ class GamesController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
uid_logger("game is is #{@game.id}, record id is #{e_record.try(:id)}, time is**** #{Time.now.strftime("%Y-%m-%d %H:%M:%S.%L")}")
|
|
|
|
|
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)
|
|
|
|
|
# 实训制作者当前拥有的金币
|
|
|
|
@ -852,7 +853,7 @@ class GamesController < ApplicationController
|
|
|
|
|
|
|
|
|
|
if max_query_index > 0
|
|
|
|
|
uid_logger("max_query_index is #{max_query_index} game id is #{@game.id}, challenge_id is #{challenge.id}")
|
|
|
|
|
@qurey_test_sets = TestSet.find_by_sql("SELECT o.code, o.actual_output, o.out_put, o.result, o.test_set_position,
|
|
|
|
|
@qurey_test_sets = TestSet.find_by_sql("SELECT o.code, o.actual_output, o.out_put, o.result, o.test_set_position, o.ts_time,
|
|
|
|
|
o.query_index, t.is_public, t.input, t.output, o.compile_success FROM outputs o, games g, challenges c,
|
|
|
|
|
test_sets t where g.id=#{@game.id} and c.id=#{challenge.id} and o.query_index=#{max_query_index}
|
|
|
|
|
and g.id = o.game_id and c.id= g.challenge_id and t.challenge_id = c.id and
|
|
|
|
@ -866,8 +867,9 @@ class GamesController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
@last_compile_output = @qurey_test_sets.first['out_put'].gsub(/\n/, '<br/>').gsub(/\t/, " \; \; \; \; \; \; \; \;") if @qurey_test_sets.first['out_put'].present?
|
|
|
|
|
else
|
|
|
|
|
# 没有评测过,第一次进来后的呈现方式
|
|
|
|
|
@qurey_test_sets = TestSet.find_by_sql("SELECT t.is_public, t.input, t.output, t.position
|
|
|
|
|
FROM test_sets t where t.challenge_id = #{challenge.id}")
|
|
|
|
|
FROM test_sets t where t.challenge_id = #{challenge.id}")
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|