Merge branch 'dev_aliyun' into dev_tj

merge aliyun
dev_tpm_ui
tangjiang 5 years ago
commit be7d87c805

@ -70,6 +70,9 @@ class HackUserLastestCodesController < ApplicationController
# 提交记录详情
def record_detail
@hack_user = HackUserCode.find params[:id]
set = HackSet.find_by(id: @hack_user.error_test_set_id)
@pass_set_count = set ? set.position - 1 : 0
@set_count = @hack_user.hack.hack_sets.count
@my_hack = @hack_user.hack_user_lastest_code
end
@ -96,7 +99,8 @@ class HackUserLastestCodesController < ApplicationController
if ojEvaResult['execMode'] == "debug"
save_debug_data ds_params
elsif ojEvaResult['execMode'] == "submit"
save_submit_data ds_params.merge(expected_output: testCase['expectedOutput'])
save_submit_data ds_params.merge(expected_output: testCase['expectedOutput'],
error_test_set_id: ojEvaResult['failCaseNum'])
end
# 评测完成后,还原评测中的状态
@my_hack.update_attribute(:submit_status, 0)

@ -1,4 +1,5 @@
class HackUserCode < ApplicationRecord
# error_test_set_id: 错误的测试集id
# 用户编程题的信息
belongs_to :hack
belongs_to :hack_user_lastest_code

@ -6,6 +6,9 @@ json.data do
json.language @hack_user.hack.language
json.name @hack_user.hack.name
json.myproblem_identifier @my_hack.identifier
json.pass_sets_count @pass_set_count
json.set_count @set_count
json.user do
json.partial! 'users/user', user: current_user
end

@ -0,0 +1,5 @@
class AddErrorTestSetIdForHackUserLastest < ActiveRecord::Migration[5.2]
def change
add_column :hack_user_codes, :error_test_set_id, :integer
end
end
Loading…
Cancel
Save