From c2489e320961a69ab6ef744b115a63a52863ef46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Wed, 12 Dec 2018 16:12:08 +0100 Subject: [PATCH] Increase number of age groups We would now like to differenciate between 70-year-old people and 90-year-old people. --- app/models/concerns/statisticable.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/models/concerns/statisticable.rb b/app/models/concerns/statisticable.rb index 6548df8c6..28cdd92b6 100644 --- a/app/models/concerns/statisticable.rb +++ b/app/models/concerns/statisticable.rb @@ -51,9 +51,13 @@ module Statisticable "55 - 59", "60 - 64", "65 - 69", - "70 - 140"].each do |group| + "70 - 74", + "75 - 79", + "80 - 84", + "85 - 89", + "90 - 140"].each do |group| 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) .where("date_of_birth > ? AND date_of_birth < ?", finish.to_i.years.ago.beginning_of_year,