You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
educoder/app/views/competitions/competitions/index.json.jbuilder

29 lines
1.0 KiB

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