json.count @count
json.competitions do
  json.array! @competitions.each do |competition|
    json.extract! competition, :id, :identifier, :name, :sub_title

    json.visits_count competition.visits
    member_count = @member_count_map&.fetch(competition.id, 0) || competition.team_members.count
    json.member_count member_count.zero? ? 268 : member_count

    json.image url_to_avatar(competition)
    json.published competition.published?
    json.nearly_published competition.published_at.present?
    json.single_stage (@stage_count_map&.fetch(competition.id, 0) || competition.competition_stages.count) == 1

    json.start_time competition.display_start_time
    json.end_time competition.display_end_time
    json.enroll_end_time competition.display_enroll_end_time

    section = competition.current_stage_section
    if section
      json.current_stage do

        json.name = section.competition_stage.name
        json.start_time section.display_start_time
        json.end_time section.display_end_time
      end
    end
  end
end