Skip to content
Extraits de code Groupes Projets
Valider 491287ed rédigé par echarp's avatar echarp
Parcourir les fichiers

Statistics only display data for the selected region

parent 208fe781
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -20,7 +20,10 @@ class StatsController < ApplicationController
end
def local
@regions = @events.joins(:region).group(:region_id, year_grouping).count
@region_events = @events.group(:region_id, year_grouping).count
@regions = Region.all.find_all do |region|
@years.sum { |year| @region_events[[region.id, year[0]]] || 0 } > 0
end
@city_events = @events.group(:city).having('count(city) > 3')
.order('count(city) desc').count
end
......
......@@ -61,15 +61,15 @@
%th= t '.total'
%th/
%tbody
- Region.all.each do |region|
- @regions.each do |region|
%tr
%th.region= region
- total = 0
- @years.each do |year|
%td.quantity
- total += @regions[[region.id, year[0]]] || 0
- total += @region_events[[region.id, year[0]]] || 0
= link_to root_path(year: year[0].to_s, region: region.id) do
= number_with_delimiter @regions[[region.id, year[0]]]
= number_with_delimiter @region_events[[region.id, year[0]]]
%th.quantity.total= number_with_delimiter total
%td.sparkline/
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter