Merge pull request #1919 from consul/chore/remove_booth_assignment_officer_totals
Remove Officer recounts, add Final&Totals votes
This commit is contained in:
@@ -45,25 +45,34 @@
|
|||||||
|
|
||||||
<div class="tabs-panel" id="tab-recounts">
|
<div class="tabs-panel" id="tab-recounts">
|
||||||
<h3><%= t("admin.poll_booth_assignments.show.recounts_list") %></h3>
|
<h3><%= t("admin.poll_booth_assignments.show.recounts_list") %></h3>
|
||||||
|
|
||||||
|
<table id="totals">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="text-center"><%= t("admin.poll_booth_assignments.show.count_final") %></th>
|
||||||
|
<th class="text-center"><%= t("admin.poll_booth_assignments.show.total_system") %></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td class="text-center" id="total_final"><%= total_recounts_by_booth(@booth_assignment) || '-' %></td>
|
||||||
|
<td class="text-center" id="total_system"><%= @booth_assignment.voters.count %></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
<table id="recounts_list">
|
<table id="recounts_list">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th><%= t("admin.poll_booth_assignments.show.date") %></th>
|
<th><%= t("admin.poll_booth_assignments.show.date") %></th>
|
||||||
<th class="text-center"><%= t("admin.poll_booth_assignments.show.total_recount") %></th>
|
|
||||||
<th class="text-center"><%= t("admin.poll_booth_assignments.show.count_by_system") %></th>
|
<th class="text-center"><%= t("admin.poll_booth_assignments.show.count_by_system") %></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<% (@poll.starts_at.to_date..@poll.ends_at.to_date).each do |voting_date| %>
|
<% (@poll.starts_at.to_date..@poll.ends_at.to_date).each do |voting_date| %>
|
||||||
<% total_recount = @booth_assignment.total_results.where(date: voting_date).first %>
|
|
||||||
<% system_count = @voters_by_date[voting_date].present? ? @voters_by_date[voting_date].size : 0 %>
|
<% system_count = @voters_by_date[voting_date].present? ? @voters_by_date[voting_date].size : 0 %>
|
||||||
<tr id="recounting_<%= voting_date.strftime('%Y%m%d') %>">
|
<tr id="recounting_<%= voting_date.strftime('%Y%m%d') %>">
|
||||||
<td><%= l voting_date %></td>
|
<td><%= l voting_date %></td>
|
||||||
<% if total_recount.present? %>
|
|
||||||
<td class="text-center <%= 'count-error' if total_recount.amount != system_count %>" title="<%= total_recount.officer_assignment.officer.name %>"><%= total_recount.amount %></td>
|
|
||||||
<% else %>
|
|
||||||
<td class="text-center" title=""> - </td>
|
|
||||||
<% end %>
|
|
||||||
<td class="text-center"><%= system_count %></td>
|
<td class="text-center"><%= system_count %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -532,8 +532,9 @@ en:
|
|||||||
recounts: "Recounts"
|
recounts: "Recounts"
|
||||||
recounts_list: "Recount list for this booth"
|
recounts_list: "Recount list for this booth"
|
||||||
date: "Date"
|
date: "Date"
|
||||||
total_recount: "Total recount (by officer)"
|
count_final: "Final recount (by officer)"
|
||||||
count_by_system: "Votes (automatic)"
|
count_by_system: "Votes (automatic)"
|
||||||
|
total_system: Total votes (automatic)
|
||||||
index:
|
index:
|
||||||
booths_title: "List of booths"
|
booths_title: "List of booths"
|
||||||
no_booths: "There are no booths assigned to this poll."
|
no_booths: "There are no booths assigned to this poll."
|
||||||
|
|||||||
@@ -532,8 +532,9 @@ es:
|
|||||||
recounts: "Recuentos"
|
recounts: "Recuentos"
|
||||||
recounts_list: "Lista de recuentos de esta urna"
|
recounts_list: "Lista de recuentos de esta urna"
|
||||||
date: "Fecha"
|
date: "Fecha"
|
||||||
total_recount: "Recuento total (presidente de mesa)"
|
count_final: "Recuento final (presidente de mesa)"
|
||||||
count_by_system: "Votos (automático)"
|
count_by_system: "Votos (automático)"
|
||||||
|
total_system: "Votos totales acumulados(automático)"
|
||||||
index:
|
index:
|
||||||
booths_title: "Listado de urnas asignadas"
|
booths_title: "Listado de urnas asignadas"
|
||||||
no_booths: "No hay urnas asignadas a esta votación."
|
no_booths: "No hay urnas asignadas a esta votación."
|
||||||
|
|||||||
@@ -97,11 +97,8 @@ feature 'Admin booths assignments' do
|
|||||||
officer_assignment_2 = create(:poll_officer_assignment, booth_assignment: booth_assignment, date: poll.ends_at)
|
officer_assignment_2 = create(:poll_officer_assignment, booth_assignment: booth_assignment, date: poll.ends_at)
|
||||||
final_officer_assignment = create(:poll_officer_assignment, :final, booth_assignment: booth_assignment, date: poll.ends_at)
|
final_officer_assignment = create(:poll_officer_assignment, :final, booth_assignment: booth_assignment, date: poll.ends_at)
|
||||||
|
|
||||||
total_recount = create(:poll_total_result,
|
create(:poll_voter, poll: poll, booth_assignment: booth_assignment, created_at: poll.starts_at.to_date)
|
||||||
booth_assignment: booth_assignment,
|
create(:poll_voter, poll: poll, booth_assignment: booth_assignment, created_at: poll.ends_at.to_date)
|
||||||
officer_assignment: final_officer_assignment,
|
|
||||||
date: final_officer_assignment.date,
|
|
||||||
amount: 5678)
|
|
||||||
|
|
||||||
booth_assignment_2 = create(:poll_booth_assignment, poll: poll)
|
booth_assignment_2 = create(:poll_booth_assignment, poll: poll)
|
||||||
|
|
||||||
@@ -111,9 +108,20 @@ feature 'Admin booths assignments' do
|
|||||||
within('#assigned_booths_list') { click_link booth.name }
|
within('#assigned_booths_list') { click_link booth.name }
|
||||||
|
|
||||||
click_link 'Recounts'
|
click_link 'Recounts'
|
||||||
|
|
||||||
|
within('#totals') do
|
||||||
|
within("#total_system") { expect(page).to have_content "2" }
|
||||||
|
end
|
||||||
|
|
||||||
within('#recounts_list') do
|
within('#recounts_list') do
|
||||||
within("#recounting_#{total_recount.date.strftime('%Y%m%d')}") do
|
within("#recounting_#{poll.starts_at.to_date.strftime('%Y%m%d')}") do
|
||||||
expect(page).to have_content total_recount.amount
|
expect(page).to have_content 1
|
||||||
|
end
|
||||||
|
within("#recounting_#{(poll.ends_at.to_date - 5.days).strftime('%Y%m%d')}") do
|
||||||
|
expect(page).to have_content '-'
|
||||||
|
end
|
||||||
|
within("#recounting_#{poll.ends_at.to_date.strftime('%Y%m%d')}") do
|
||||||
|
expect(page).to have_content 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user