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