|
|
@ -533,6 +533,7 @@ class GamesService
|
|
|
|
|
|
|
|
|
|
|
|
# 更新评测次数
|
|
|
|
# 更新评测次数
|
|
|
|
game.update_column(:evaluate_count, (game.evaluate_count.to_i + 1))
|
|
|
|
game.update_column(:evaluate_count, (game.evaluate_count.to_i + 1))
|
|
|
|
|
|
|
|
shixun.increment!(:evaluate_count)
|
|
|
|
# 清空代码评测信息
|
|
|
|
# 清空代码评测信息
|
|
|
|
msg = game.run_code_message
|
|
|
|
msg = game.run_code_message
|
|
|
|
msg.update_attributes(:status => 0, :message => nil) if msg.present?
|
|
|
|
msg.update_attributes(:status => 0, :message => nil) if msg.present?
|
|
|
@ -599,9 +600,9 @@ class GamesService
|
|
|
|
return {:result => "success", :resubmit => resubmit, :ableToCreate => res['ableToCreate'], :waitNum => res['waitNum'],
|
|
|
|
return {:result => "success", :resubmit => resubmit, :ableToCreate => res['ableToCreate'], :waitNum => res['waitNum'],
|
|
|
|
:waitingTime => res['waitingTime'], :position => game_challenge.position, :port => res['port'],
|
|
|
|
:waitingTime => res['waitingTime'], :position => game_challenge.position, :port => res['port'],
|
|
|
|
:had_done => game.had_done}
|
|
|
|
:had_done => game.had_done}
|
|
|
|
# rescue Exception => e
|
|
|
|
rescue Exception => e
|
|
|
|
# Rails.logger.error("评测出错,详情:" + e.message)
|
|
|
|
Rails.logger.error("评测出错,详情:" + e.message)
|
|
|
|
# return {:result => 'fail', :contents =>"实训云平台繁忙(繁忙等级:502),请稍后刷新并重试", :position => game_challenge.position, :had_done => game.had_done}
|
|
|
|
return {:result => 'fail', :contents =>"实训云平台繁忙(繁忙等级:502),请稍后刷新并重试", :position => game_challenge.position, :had_done => game.had_done}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
# 单评测类型(比较快的类型,实时返回结果,即不用中间层再回调trainint_task_status)
|
|
|
|
# 单评测类型(比较快的类型,实时返回结果,即不用中间层再回调trainint_task_status)
|
|
|
@ -693,6 +694,7 @@ class GamesService
|
|
|
|
:evaluate_count]).find_by_identifier(params[:identifier])
|
|
|
|
:evaluate_count]).find_by_identifier(params[:identifier])
|
|
|
|
# 更新评测次数
|
|
|
|
# 更新评测次数
|
|
|
|
game.update_column(:evaluate_count, (game.evaluate_count.to_i + 1))
|
|
|
|
game.update_column(:evaluate_count, (game.evaluate_count.to_i + 1))
|
|
|
|
|
|
|
|
game.challenge.shixun.increment!(:evaluate_count)
|
|
|
|
|
|
|
|
|
|
|
|
# 选择题如果通关了,则不让再评测
|
|
|
|
# 选择题如果通关了,则不让再评测
|
|
|
|
if game.status == 2
|
|
|
|
if game.status == 2
|
|
|
|