Skip to content

Commit

Permalink
Update stats.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
scotthillson committed Oct 17, 2024
1 parent 0c6f7f3 commit 8f38af6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/services/stats.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit 8f38af6

Please sign in to comment.