Increase number of age groups

We would now like to differenciate between 70-year-old people and
90-year-old people.
This commit is contained in:
Javi Martín
2018-12-12 16:12:08 +01:00
parent e4a032ee68
commit c2489e3209

View File

@@ -51,9 +51,13 @@ module Statisticable
"55 - 59", "55 - 59",
"60 - 64", "60 - 64",
"65 - 69", "65 - 69",
"70 - 140"].each do |group| "70 - 74",
"75 - 79",
"80 - 84",
"85 - 89",
"90 - 140"].each do |group|
start, finish = group.split(" - ") start, finish = group.split(" - ")
group_name = (group == "70 - 140" ? "+ 70" : group) group_name = (group == "90 - 140" ? "+ 90" : group)
groups[group_name] = User.where(id: participants) groups[group_name] = User.where(id: participants)
.where("date_of_birth > ? AND date_of_birth < ?", .where("date_of_birth > ? AND date_of_birth < ?",
finish.to_i.years.ago.beginning_of_year, finish.to_i.years.ago.beginning_of_year,