Add cumulative totals to admin poll recounts list

This commit backports commit AyuntamientoMadrid@90638672 and the changes
that code has been through:

* AyuntamientoMadrid@03371a71 removed daily recounts in the controller
* AyuntamientoMadrid@fe3492a7 removed daily recounts in the view
* AyuntamientoMadrid@aa59d995 replaced FinalRecount with TotalResult
* AyuntamientoMadrid@c40e8d79 replaced TotalResult with Recount
This commit is contained in:
Juanjo Bazán
2017-02-19 18:41:21 +01:00
committed by Javi Martín
parent b96e2d4510
commit 26d1024cfc
4 changed files with 28 additions and 0 deletions

View File

@@ -6,6 +6,10 @@ class Admin::Poll::RecountsController < Admin::Poll::BaseController
includes(:booth, :recounts, :voters).
order("poll_booths.name").
page(params[:page]).per(50)
@all_booths_counts = {
final: ::Poll::Recount.select(:total_amount).where(booth_assignment_id: @poll.booth_assignment_ids).sum(:total_amount),
system: ::Poll::Voter.where(booth_assignment_id: @poll.booth_assignment_ids).count
}
end
private

View File

@@ -9,6 +9,24 @@
<%= t("admin.recounts.index.no_recounts") %>
</div>
<% else %>
<table id="totals">
<thead>
<tr>
<th class="text-center"></th>
<th class="text-center"><%= t("admin.recounts.index.total_final") %></th>
<th class="text-center"><%= t("admin.recounts.index.total_system") %></th>
</tr>
</thead>
<tbody>
<tr>
<td><strong><%= t("admin.recounts.index.all_booths_total") %></strong></td>
<td class="text-center" id="total_final"><%= @all_booths_counts[:final] %></td>
<td class="text-center" id="total_system"><%= @all_booths_counts[:system] %></td>
</tr>
</tbody>
</table>
<table class="fixed margin">
<thead>
<th><%= t("admin.recounts.index.table_booth_name") %></th>

View File

@@ -1049,6 +1049,9 @@ en:
index:
title: "Recounts"
no_recounts: "There is nothing to be recounted"
all_booths_total: "Cumulative total from all booths:"
total_final: "Final recounts"
total_system: "Votes (automatic)"
table_booth_name: "Booth"
table_total_recount: "Total recount (by officer)"
table_system_count: "Votes (automatic)"

View File

@@ -1048,6 +1048,9 @@ es:
index:
title: "Recuentos"
no_recounts: "No hay nada de lo que hacer recuento"
all_booths_total: "Acumulado en todas las urnas:"
total_final: "Recuentos finales"
total_system: "Votos (automático)"
table_booth_name: "Urna"
table_total_recount: "Recuento total (presidente de mesa)"
table_system_count: "Votos (automático)"