From 0a772dd67b666cb28362bd40076d3566eaa03e9e Mon Sep 17 00:00:00 2001 From: daiao <35855898@qq.com> Date: Sat, 16 Mar 2019 09:36:17 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=84=E6=B5=8B=E4=B8=AD=E7=9A=84=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/myshixuns_controller.rb | 3 +++ app/services/games_service.rb | 13 ++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index cdc3d682..3b747970 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -567,6 +567,9 @@ class MyshixunsController < ApplicationController :create_pod => timeCost['createPod'], :pod_execute => timeCost['execute'], :test_cases => test_cases_time, :brige => timeCost['evaluateAllTime'], :return_back => return_back_time) end + # 清空代码评测信息 + msg = game.run_code_message + msg.update_column(:status => 0, :message => nil) if msg.present? logger.info("training_task_status start#4**#{game_id}**** #{Time.now.strftime("%Y-%m-%d %H:%M:%S.%L")}") render :json => {:data => "success"} rescue Exception => e diff --git a/app/services/games_service.rb b/app/services/games_service.rb index d7b56838..bcb1d61b 100644 --- a/app/services/games_service.rb +++ b/app/services/games_service.rb @@ -886,9 +886,16 @@ class GamesService 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} - 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, - :star => game.star, :next_game => next_game, :prev_game => prev_game}.merge(output_hash) + + # 代码评测的信息 + 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, + :position => game_challenge.position, :port => port, :power => power, :record => record, + :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, + :running_code_status => running_code_status, :running_code_message => running_code_message}.merge(output_hash) end # 记录实训花费的时间,前端是通过ent_time - open_time,所以最终只更新open_time即可