fixed 个人提交作品增加历史,时间,错误信息

This commit is contained in:
xxq250 2025-08-01 10:14:58 +08:00
parent 2d6cbd6b04
commit 1a262e4fd5
3 changed files with 9 additions and 7 deletions

View File

@ -4,13 +4,13 @@ class CompetitionUserScore < ApplicationRecord
serialize :api_result, JSON
# def api_result_text
# "" if self.api_status != 3 || self.api_result.blank?
# data = JSON.parse self.api_result
# data["msg"].present? ? data["msg"] : data["errorOutput"].present? ? data["errorOutput"] : "系统打分错误,信息不详"
# rescue =>err
# return nil
# end
def api_result_text
"" if self.api_status != 3 || self.api_result.blank?
data = api_result["data"]
data["msg"].present? ? data["msg"] : data["errorOutput"].present? ? data["errorOutput"] : "系统打分错误,信息不详"
rescue =>err
return nil
end
def api_result_data
{} if self.api_status != 3 || self.api_result.blank?

View File

@ -16,6 +16,7 @@ json.data do
json.history_scores c_user.competition_user_scores do |user_score|
json.created_at user_score.created_at
json.score user_score.api_result_data
json.api_result_text user_score.api_result_text
end
json.enroll_template do
file = Attachment.where_id_or_uuid(c_user.enroll_template_id).first

View File

@ -21,6 +21,7 @@ json.data do
json.history_scores @competition_user.competition_user_scores do |user_score|
json.created_at user_score.created_at
json.score user_score.api_result_data
json.api_result_text user_score.api_result_text
end
json.enroll_template do
file = Attachment.where_id_or_uuid(@competition_user.enroll_template_id).first