forked from Gitlink/forgeplus
fixed 后台查询打榜分和历史
This commit is contained in:
parent
d538219802
commit
33442c5fca
|
@ -2,6 +2,8 @@
|
|||
class CompetitionUserScore < ApplicationRecord
|
||||
belongs_to :competition_user
|
||||
|
||||
serialize :api_result, JSON
|
||||
|
||||
def api_result_text
|
||||
"" if self.api_status != 3 || self.api_result.blank?
|
||||
data = JSON.parse self.api_result
|
||||
|
|
|
@ -12,8 +12,10 @@ json.data do
|
|||
json.apply_status c_user&.apply_status
|
||||
json.score @stage.present? ? c_user.stage_score(@stage) : c_user.score
|
||||
json.last_score @stage.present? ? c_user.stage_last_score(@stage) : c_user.last_score
|
||||
json.other_score_json @stage.present? ? c_user.stage_max_score_data(@stage) : c_user.last_score
|
||||
json.history_scores @stage.present? ? c_user.competition_user_scores.to_json : []
|
||||
json.other_score_json c_user.stage_max_score_data["data"].present? ? c_user.stage_max_score_data["data"] : c_user.api_result_data
|
||||
json.history_scores c_user.competition_user_scores do |user_score|
|
||||
json.score user_score.api_result
|
||||
end
|
||||
json.enroll_template do
|
||||
file = Attachment.where_id_or_uuid(c_user.enroll_template_id).first
|
||||
json.partial! 'attachments/attachment_simple', attachment: file if file.present?
|
||||
|
|
|
@ -11,6 +11,6 @@ json.data do
|
|||
json.score @stage.present? ? c_user.stage_score(@stage) : c_user.score
|
||||
json.last_score @stage.present? ? c_user.stage_last_score(@stage) : c_user.last_score
|
||||
json.other_score_1 c_user.api_result_data["repeatTripleSet"].present? ? c_user.api_result_data["repeatTripleSet"] : 0
|
||||
json.other_score_json @stage.present? ? c_user.stage_max_score_data(@stage) : c_user.last_score
|
||||
json.other_score_json c_user.stage_max_score_data["data"].present? ? c_user.stage_max_score_data["data"] : c_user.api_result_data
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue