forked from Gitlink/forgeplus
54 lines
2.8 KiB
Ruby
54 lines
2.8 KiB
Ruby
json.status 0
|
|
json.message "success"
|
|
json.data do
|
|
json.enroll_status @competition_user.present?
|
|
json.status @competition_user&.status.to_i
|
|
json.apply_status @competition_user&.apply_status
|
|
json.second_round @competition_info.identifier == "zstp2022" ? @second_round : true
|
|
if @competition_user.present?
|
|
json.enroll_info do
|
|
json.extract! @competition_user, :org_name, :org_job, :org_rank, :leader, :zone, :sub_competition, :subject_source_type,
|
|
:subject_source_name, :phone, :status, :mail, :ext1, :ext2, :ext3, :ext4, :ext5, :sub_item, :works_name, :works_url,
|
|
:bm_file_id, :teacher_name, :teacher_dept, :teacher_email, :teacher_phone, :teacher_professional
|
|
json.user_id @competition_user.user_id
|
|
json.user_real_name @competition_user.user&.real_name
|
|
json.members @competition_user.members
|
|
json.api_limit @count_control.present?
|
|
json.api_status @stage.present? ? @competition_user.stage_api_status(@stage) : @competition_user.api_status
|
|
json.api_result_text @stage.present? ? @competition_user.stage_api_result_text(@stage) : @competition_user.api_result_text
|
|
json.score @stage.present? ? @competition_user.stage_score(@stage) : @competition_user.score
|
|
json.last_score @stage.present? ? @competition_user.stage_last_score(@stage) : @competition_user.last_score
|
|
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
|
|
json.partial! 'attachments/attachment_simple', attachment: file if file.present?
|
|
end
|
|
json.apply_template do
|
|
file = Attachment.where_id_or_uuid(@competition_user.ext2).first
|
|
json.partial! 'attachments/attachment_simple', attachment: file if file.present?
|
|
end
|
|
json.bm_file do
|
|
file = Attachment.where_id_or_uuid(@competition_user.bm_file_id).first
|
|
json.partial! 'attachments/attachment_simple', attachment: file if file.present?
|
|
end
|
|
end
|
|
end
|
|
json.upload_status @competition_user.present? ? @competition_user.attachments.present? : false
|
|
if @competition_user.present? && @competition_user.attachments.present?
|
|
if @stage.present?
|
|
if @competition_user.stage_api_status(@stage) > 0
|
|
json.attachments @competition_user.attachments.order(id: :desc).limit(1) do |attachment|
|
|
json.partial! "attachments/attachment_simple", locals: { attachment: attachment }
|
|
end
|
|
end
|
|
else
|
|
json.attachments @competition_user.attachments do |attachment|
|
|
json.partial! "attachments/attachment_simple", locals: { attachment: attachment }
|
|
end
|
|
end
|
|
end
|
|
end |