diff --git a/app/controllers/hack_user_lastest_codes_controller.rb b/app/controllers/hack_user_lastest_codes_controller.rb index caee23936..2ece96ad5 100644 --- a/app/controllers/hack_user_lastest_codes_controller.rb +++ b/app/controllers/hack_user_lastest_codes_controller.rb @@ -70,6 +70,9 @@ class HackUserLastestCodesController < ApplicationController # 提交记录详情 def record_detail @hack_user = HackUserCode.find params[:id] + set = HackSet.find_by(error_test_set_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 diff --git a/app/views/hack_user_lastest_codes/record_detail.json.jbuilder b/app/views/hack_user_lastest_codes/record_detail.json.jbuilder index 66eedf85e..18eb012a1 100644 --- a/app/views/hack_user_lastest_codes/record_detail.json.jbuilder +++ b/app/views/hack_user_lastest_codes/record_detail.json.jbuilder @@ -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