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:
committed by
Javi Martín
parent
b96e2d4510
commit
26d1024cfc
@@ -6,6 +6,10 @@ class Admin::Poll::RecountsController < Admin::Poll::BaseController
|
|||||||
includes(:booth, :recounts, :voters).
|
includes(:booth, :recounts, :voters).
|
||||||
order("poll_booths.name").
|
order("poll_booths.name").
|
||||||
page(params[:page]).per(50)
|
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
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
@@ -9,6 +9,24 @@
|
|||||||
<%= t("admin.recounts.index.no_recounts") %>
|
<%= t("admin.recounts.index.no_recounts") %>
|
||||||
</div>
|
</div>
|
||||||
<% else %>
|
<% 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">
|
<table class="fixed margin">
|
||||||
<thead>
|
<thead>
|
||||||
<th><%= t("admin.recounts.index.table_booth_name") %></th>
|
<th><%= t("admin.recounts.index.table_booth_name") %></th>
|
||||||
|
|||||||
@@ -1049,6 +1049,9 @@ en:
|
|||||||
index:
|
index:
|
||||||
title: "Recounts"
|
title: "Recounts"
|
||||||
no_recounts: "There is nothing to be recounted"
|
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_booth_name: "Booth"
|
||||||
table_total_recount: "Total recount (by officer)"
|
table_total_recount: "Total recount (by officer)"
|
||||||
table_system_count: "Votes (automatic)"
|
table_system_count: "Votes (automatic)"
|
||||||
|
|||||||
@@ -1048,6 +1048,9 @@ es:
|
|||||||
index:
|
index:
|
||||||
title: "Recuentos"
|
title: "Recuentos"
|
||||||
no_recounts: "No hay nada de lo que hacer recuento"
|
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_booth_name: "Urna"
|
||||||
table_total_recount: "Recuento total (presidente de mesa)"
|
table_total_recount: "Recuento total (presidente de mesa)"
|
||||||
table_system_count: "Votos (automático)"
|
table_system_count: "Votos (automático)"
|
||||||
|
|||||||
Reference in New Issue
Block a user