Replace FinalResult with TotalResult at admin Poll Recounts page
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
module PollRecountsHelper
|
module PollRecountsHelper
|
||||||
|
|
||||||
def booth_assignment_sum_final_recounts(ba)
|
def total_recounts_by_booth(booth_assignment)
|
||||||
ba.final_recounts.any? ? ba.final_recounts.to_a.sum(&:count) : nil
|
booth_assignment.total_results.any? ? booth_assignment.total_results.to_a.sum(&:amount) : nil
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -12,12 +12,12 @@
|
|||||||
<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>
|
||||||
<th class="text-center"><%= t("admin.recounts.index.table_final_recount") %></th>
|
<th class="text-center"><%= t("admin.recounts.index.table_total_recount") %></th>
|
||||||
<th class="text-center"><%= t("admin.recounts.index.table_system_count") %></th>
|
<th class="text-center"><%= t("admin.recounts.index.table_system_count") %></th>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<% @booth_assignments.each do |booth_assignment| %>
|
<% @booth_assignments.each do |booth_assignment| %>
|
||||||
<% final_recount = booth_assignment_sum_final_recounts(booth_assignment) %>
|
<% total_recounts = total_recounts_by_booth(booth_assignment) %>
|
||||||
<% system_count = booth_assignment.voters.size %>
|
<% system_count = booth_assignment.voters.size %>
|
||||||
<tr id="<%= dom_id(booth_assignment) %>_recounts" class="booth_recounts">
|
<tr id="<%= dom_id(booth_assignment) %>_recounts" class="booth_recounts">
|
||||||
<td>
|
<td>
|
||||||
@@ -25,9 +25,9 @@
|
|||||||
<%= link_to booth_assignment.booth.name, admin_poll_booth_assignment_path(@poll, booth_assignment, anchor: 'tab-recounts') %>
|
<%= link_to booth_assignment.booth.name, admin_poll_booth_assignment_path(@poll, booth_assignment, anchor: 'tab-recounts') %>
|
||||||
</strong>
|
</strong>
|
||||||
</td>
|
</td>
|
||||||
<td class="text-center <%= 'count-error' if final_recount.to_i != system_count %>">
|
<td class="text-center <%= 'count-error' if total_recounts.to_i != system_count %>">
|
||||||
<% if final_recount.present? %>
|
<% if total_recounts.present? %>
|
||||||
<strong><%= final_recount %></strong>
|
<strong><%= total_recounts %></strong>
|
||||||
<% else %>
|
<% else %>
|
||||||
<span>-</span>
|
<span>-</span>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -604,7 +604,7 @@ en:
|
|||||||
title: "Recounts"
|
title: "Recounts"
|
||||||
no_recounts: "There is nothing to be recounted"
|
no_recounts: "There is nothing to be recounted"
|
||||||
table_booth_name: "Booth"
|
table_booth_name: "Booth"
|
||||||
table_final_recount: "Final recount (by officer)"
|
table_total_recount: "Total recount (by officer)"
|
||||||
table_system_count: "Votes (automatic)"
|
table_system_count: "Votes (automatic)"
|
||||||
results:
|
results:
|
||||||
index:
|
index:
|
||||||
|
|||||||
@@ -604,7 +604,7 @@ es:
|
|||||||
title: "Recuentos"
|
title: "Recuentos"
|
||||||
no_recounts: "No hay nada de lo que hacer recuento"
|
no_recounts: "No hay nada de lo que hacer recuento"
|
||||||
table_booth_name: "Urna"
|
table_booth_name: "Urna"
|
||||||
table_final_recount: "Recuento final (presidente de mesa)"
|
table_total_recount: "Recuento total (presidente de mesa)"
|
||||||
table_system_count: "Votos (automático)"
|
table_system_count: "Votos (automático)"
|
||||||
results:
|
results:
|
||||||
index:
|
index:
|
||||||
|
|||||||
@@ -391,7 +391,7 @@ fr:
|
|||||||
no_recounts: "Il n'y a rien à dépouiller"
|
no_recounts: "Il n'y a rien à dépouiller"
|
||||||
table_booth_name: "Bureau de vote"
|
table_booth_name: "Bureau de vote"
|
||||||
table_recounts: "Accumulation des dépouillements journaliers (par président)"
|
table_recounts: "Accumulation des dépouillements journaliers (par président)"
|
||||||
table_final_recount: "Dépouillement final (par président)"
|
table_total_recount: "Dépouillement final (par président)"
|
||||||
table_system_count: "Votes (automatique)"
|
table_system_count: "Votes (automatique)"
|
||||||
results:
|
results:
|
||||||
index:
|
index:
|
||||||
|
|||||||
@@ -391,7 +391,7 @@ nl:
|
|||||||
no_recounts: "There is nothing to be recounted"
|
no_recounts: "There is nothing to be recounted"
|
||||||
table_booth_name: "Booth"
|
table_booth_name: "Booth"
|
||||||
table_recounts: "Accumulated daily recounts (by officer)"
|
table_recounts: "Accumulated daily recounts (by officer)"
|
||||||
table_final_recount: "Final recount (by officer)"
|
table_total_recount: "Final recount (by officer)"
|
||||||
table_system_count: "Votes (automatic)"
|
table_system_count: "Votes (automatic)"
|
||||||
results:
|
results:
|
||||||
index:
|
index:
|
||||||
|
|||||||
@@ -249,18 +249,18 @@ feature 'Admin polls' do
|
|||||||
booth_assignment_final_recounted = create(:poll_booth_assignment, poll: poll)
|
booth_assignment_final_recounted = create(:poll_booth_assignment, poll: poll)
|
||||||
|
|
||||||
3.times do |i|
|
3.times do |i|
|
||||||
create(:poll_final_recount,
|
create(:poll_total_result,
|
||||||
booth_assignment: booth_assignment,
|
booth_assignment: booth_assignment,
|
||||||
date: poll.starts_at + i.days,
|
date: poll.starts_at + i.days,
|
||||||
count: 21)
|
amount: 21)
|
||||||
end
|
end
|
||||||
|
|
||||||
2.times { create(:poll_voter, booth_assignment: booth_assignment_final_recounted) }
|
2.times { create(:poll_voter, booth_assignment: booth_assignment_final_recounted) }
|
||||||
|
|
||||||
create(:poll_final_recount,
|
create(:poll_total_result,
|
||||||
booth_assignment: booth_assignment_final_recounted,
|
booth_assignment: booth_assignment_final_recounted,
|
||||||
date: poll.ends_at,
|
date: poll.ends_at,
|
||||||
count: 55555)
|
amount: 55555)
|
||||||
|
|
||||||
visit admin_poll_path(poll)
|
visit admin_poll_path(poll)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user