diff --git a/app/services/stats.rb b/app/services/stats.rb index 1197104e6..3f996770b 100644 --- a/app/services/stats.rb +++ b/app/services/stats.rb @@ -173,7 +173,7 @@ def self.total_juniors(years) years.each do |year| res = Result.joins(:event, :person).where(events: { year: year, type: "SingleDayEvent" }) .where(competition_result: false, team_competition_result: false) - .where(category_id: Category.where("ages_begin > ? AND ages_begin < ?", 0, 19).select(:id)) + .where(category_id: Category.where(ages_begin: 1..18).select(:id)) .where.not(person_id: nil).distinct .count(:person_id) chart_data[0][:data].push(res) @@ -185,9 +185,9 @@ def self.junior_racer_days(years) chart_data = [{ name: "Juniors", data: [] }] years.each do |year| res = Result.joins(:event, :person).where(events: { year: year, type: "SingleDayEvent" }) - .where(category_id: Category.where("ages_begin > ? AND ages_begin < ?", 0, 19).select(:id)) + .where(category_id: Category.where(ages_begin: 1..18).select(:id)) .where(competition_result: false, team_competition_result: false) - .where.not(person_id: nil) + .where.not(person_id: nil).count chart_data[0][:data].push(res) end chart_data