Ajout total par région

This commit is contained in:
echarp 2014-11-06 00:33:33 +01:00
parent d9b69aff05
commit 3d6e478a6d

View File

@ -19,6 +19,7 @@
%th/ %th/
- @years.each do |year| - @years.each do |year|
%th= year[0] %th= year[0]
%th/
%tbody %tbody
- (1..12).each do |m| - (1..12).each do |m|
%tr %tr
@ -50,14 +51,19 @@
%th/ %th/
- @years.each do |year| - @years.each do |year|
%th= year[0] %th= year[0]
%th=t '.total'
%th/
%tbody %tbody
- Region.all.each do |region| - Region.all.each do |region|
%tr %tr
%th.month= region %th.month= region
- total = 0
- @years.each do |year| - @years.each do |year|
%td.quantity %td.quantity
- total += @regions[[region.id, year[0]]] || 0
= link_to root_path(year: "#{year[0]}", region: region.id) do = link_to root_path(year: "#{year[0]}", region: region.id) do
= number_with_delimiter @regions[[region.id, year[0]]] = number_with_delimiter @regions[[region.id, year[0]]]
%th.total= number_with_delimiter total
%td.sparkline/ %td.sparkline/
%h3=t '.city' %h3=t '.city'