From f80d1ea4a03839be529b6111e2a3c13526460092 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 17 Oct 2017 09:39:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=BE=93=E5=85=A5=E8=BE=93?= =?UTF-8?q?=E5=87=BA=E8=AF=84=E6=B5=8B=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/myshixuns_controller.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index 5e7b8b4f6..9f5e59b67 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -71,7 +71,7 @@ class MyshixunsController < ApplicationController shixun = @myshixun.shixun @challenges = shixun.challenges # 删除选择题用户记录 - + #end myshixun_job = Base64.urlsafe_encode64("myshixun_#{@myshixun.id}") StudentWork.where(:myshixun_id => @myshixun.id).update_all(:myshixun_id => nil, :work_status => 0) @@ -126,14 +126,14 @@ class MyshixunsController < ApplicationController logger.info "actual_output:################################################# #{actual_output}" game_outputs = Output.create(:code => status, :game_id => game_id, :out_put => outPut, :test_set_position => j_test_set['caseId'], :actual_output => actual_output, :result => j_test_set['passed'].to_i, :query_index => game.query_index, :compile_success => compile_success.to_i) - # output = Output.where(:game_id => game.id, :test_set_position => j_test_set['caseId'].to_i).first - # logger.info("#############{outPut}") - # if output.nil? - # game_outputs = Output.create(:code => status, :game_id => game_id, :out_put => outPut, :test_set_position => j_test_set['caseId'], - # :actual_output => actual_output, :result => j_test_set['passed'].to_i) - # else - # output.update_attributes(:code => status, :out_put => outPut, :actual_output => actual_output, :result => j_test_set['passed'].to_i) - # end + output = Output.where(:game_id => game.id, :test_set_position => j_test_set['caseId'].to_i).first + logger.info("#############{outPut}") + if output.nil? + game_outputs = Output.create(:code => status, :game_id => game_id, :out_put => outPut, :test_set_position => j_test_set['caseId'], + :actual_output => actual_output, :result => j_test_set['passed'].to_i) + else + output.update_attributes(:code => status, :out_put => outPut, :actual_output => actual_output, :result => j_test_set['passed'].to_i) + end end end if status == "0"