竞赛排行榜的显示条数应该时配置页的总奖项数

dev_home
cxt 5 years ago
parent 239674ca75
commit 3876d69b29

@ -143,7 +143,7 @@ class Competitions::CompetitionsController < Competitions::BaseController
}
end
else
@records = @records.includes(:team_members, competition_prize_users: :competition_prize, user: :user_extension).limit(@competition.awards_count)
@records = @records.includes(:team_members, competition_prize_users: :competition_prize, user: :user_extension).limit(@competition.charts_count)
end
end

@ -149,9 +149,9 @@ class Competition < ApplicationRecord
competition_stages.map(&:max_end_time).max
end
# def awards_count
# competition_awards.pluck(:num)&.sum > 0 ? competition_awards.pluck(:num)&.sum : 20
# end
def charts_count
competition_awards.pluck(:num)&.sum > 0 ? competition_awards.pluck(:num)&.sum : awards_count
end
def manager?(user)
user && competition_managers.exists?(user_id: user.id)

Loading…
Cancel
Save