竞赛接口调整

dev_auth
cxt 5 years ago
parent e680c4d35f
commit 574275cbc7

@ -21,7 +21,7 @@ class Competitions::CompetitionsController < Competitions::BaseController
@count = competitions.count
competitions = competitions.order(published_at: :desc, online_time: :desc)
@competitions = paginate(competitions.includes(current_stage_section: :competition_stage))
@competitions = paginate(competitions.includes(:sponsor_schools, current_stage_section: :competition_stage))
ids = @competitions.map(&:id)
@member_count_map = TeamMember.where(competition_id: ids).group(:competition_id).count

@ -6,6 +6,7 @@ json.member_count member_count.zero? ? 268 : member_count
json.start_time @competition.start_time&.strftime("%Y-%m-%d")
json.end_time @competition.end_time&.strftime("%Y-%m-%d")
json.enroll_end_time @competition.enroll_end_time&.strftime("%Y-%m-%d %H:%M:%S")
json.enroll_end @competition.enroll_end_time && @competition.enroll_end_time < Time.now
json.published @competition.published?
json.nearly_published @competition.published_at.present?

@ -17,6 +17,7 @@ json.competitions do
json.end_time competition.end_time&.strftime("%Y-%m-%d")
json.enroll_end_time competition.enroll_end_time&.strftime("%Y-%m-%d %H:%M:%S")
json.sponsor_schools competition.sponsor_schools.pluck(:name)
# section = competition.current_stage_section
# if section
# json.current_stage do

Loading…
Cancel
Save