diff --git a/app/controllers/hack_user_lastest_codes_controller.rb b/app/controllers/hack_user_lastest_codes_controller.rb index 442e9ca3b..b7ec6fb8e 100644 --- a/app/controllers/hack_user_lastest_codes_controller.rb +++ b/app/controllers/hack_user_lastest_codes_controller.rb @@ -68,6 +68,7 @@ class HackUserLastestCodesController < ApplicationController # 提交记录详情 def record_detail @hack_user = HackUserCode.find params[:id] + @my_hack = @hack_user.hack_user_lastest_code end # 接收中间件返回结果接口 diff --git a/app/models/hack_user_code.rb b/app/models/hack_user_code.rb index 072fd4e31..eee394e39 100644 --- a/app/models/hack_user_code.rb +++ b/app/models/hack_user_code.rb @@ -1,6 +1,7 @@ class HackUserCode < ApplicationRecord # 用户编程题的信息 belongs_to :hack + belongs_to :hack_user_lastest_code scope :created_order, ->{ order("created_at desc")} 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 4b77c2e00..8f72014fe 100644 --- a/app/views/hack_user_lastest_codes/record_detail.json.jbuilder +++ b/app/views/hack_user_lastest_codes/record_detail.json.jbuilder @@ -1,4 +1,8 @@ json.(@hack_user, :id, :status, :error_line, :error_msg, :expected_output, :input, :output, :execute_time, :execute_memory, :created_at, :code) json.language @hack_user.hack.language -json.name @hack_user.hack.name \ No newline at end of file +json.name @hack_user.hack.name +json.myproblem_identifier @my_hack.identifier +json.user do + json.partial! 'users/user', user: current_user +end \ No newline at end of file