From 8ab31d7ae02ae691272a8a2f1a3c62b475d54175 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 18 Nov 2019 19:32:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=93=E5=8D=B0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/hack_user_lastest_codes_controller.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/controllers/hack_user_lastest_codes_controller.rb b/app/controllers/hack_user_lastest_codes_controller.rb index f17c65270..0638f54ba 100644 --- a/app/controllers/hack_user_lastest_codes_controller.rb +++ b/app/controllers/hack_user_lastest_codes_controller.rb @@ -24,7 +24,7 @@ class HackUserLastestCodesController < ApplicationController # 提交 def code_submit - exec_mode = "normal" + exec_mode = "submit" error_status = 502 error_msg = "submit_error" oj_evaluate exec_mode, error_status, error_msg @@ -49,6 +49,7 @@ class HackUserLastestCodesController < ApplicationController regular_match_error_line ojEvaResult['outPut'], @my_hack.hack.language end # debug 与submit 公用的参数 + ds_params = {input: testCase['input'], output: testCase['output'], hack_id: @hack.id, user_id: @my_hack.user_id, error_line: error_line, status: ojEvaResult['status'], error_msg: ojEvaResult[:outPut], execute_time: ojEvaResult['executeTime'], @@ -57,7 +58,7 @@ class HackUserLastestCodesController < ApplicationController # debug模式与submit模式 if params[:execMode] == "debug" save_debug_data ds_params - elsif params[:execMode] == "normal" + elsif params[:execMode] == "submit" save_submit_data ds_params end # 评测完成后,还原评测中的状态 @@ -78,7 +79,7 @@ class HackUserLastestCodesController < ApplicationController def oj_evaluate exec_mode, error_status, error_msg request_url = "#{edu_setting('cloud_bridge')}/bridge/ojs/evaluate" test_sets = - if exec_mode == "normal" + if exec_mode == "submit" @hack.hack_sets.map{|set| {input: set.input, output: set.output, caseId: set.id}} else {input: params[:input]} @@ -133,6 +134,7 @@ class HackUserLastestCodesController < ApplicationController end end # 创建用户评测记录 + logger.info("###########submit_params:#{submit_params}") @my_hack.hack_user_codes.create!(submit_params) end