json.status 0
json.message "success"
json.count @competition_users_count
json.data do
  json.array! @competition_users.to_a do |c_user|
    json.extract! c_user, :id, :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 c_user.user_id
    json.user_real_name c_user.user&.real_name
    json.members c_user.members
    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).present? ? c_user.stage_max_score_data(@stage): c_user.api_result_data
    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
      json.partial! 'attachments/attachment_simple', attachment: file if file.present?
    end
    json.apply_template do
      file = Attachment.where_id_or_uuid(c_user.ext2).first
      json.partial! 'attachments/attachment_simple', attachment: file if file.present?
    end
    json.bm_file do
      file = Attachment.where_id_or_uuid(c_user.bm_file_id).first
      json.partial! 'attachments/attachment_simple', attachment: file if file.present?
    end
    json.attachments c_user.attachments do |attachment|
      json.partial! "attachments/attachment_simple", locals: {attachment: attachment}
    end
  end
end