From 0b55097820466bcc1a56ce0c80c8a44c6934e0c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Sat, 1 Jun 2019 21:08:06 +0200 Subject: [PATCH] Remove system count from old booth assigments This number was not the important one; the important one is the one given by the recounts. Note we're also removing the votes by date, since they're also system votes. --- .../poll/booth_assignments/show.html.erb | 48 +++++++++++-------- .../admin/poll/booth_assigments_spec.rb | 20 ++++++++ 2 files changed, 48 insertions(+), 20 deletions(-) diff --git a/app/views/admin/poll/booth_assignments/show.html.erb b/app/views/admin/poll/booth_assignments/show.html.erb index 65dfe2f12..64d73ebaf 100644 --- a/app/views/admin/poll/booth_assignments/show.html.erb +++ b/app/views/admin/poll/booth_assignments/show.html.erb @@ -58,7 +58,10 @@ <%= t("admin.poll_booth_assignments.show.count_final") %> - <%= t("admin.poll_booth_assignments.show.total_system") %> + + <% unless @poll.recounts_confirmed? %> + <%= t("admin.poll_booth_assignments.show.total_system") %> + <% end %> @@ -66,30 +69,35 @@ <%= total_recounts_by_booth(@booth_assignment) || "-" %> - - <%= @booth_assignment.voters.count %> - + + <% unless @poll.recounts_confirmed? %> + + <%= @booth_assignment.voters.count %> + + <% end %> - - - - - - - - - <% (@poll.starts_at.to_date..@poll.ends_at.to_date).each do |voting_date| %> - <% system_count = @voters_by_date[voting_date].present? ? @voters_by_date[voting_date].size : 0 %> - "> - - + <% unless @poll.recounts_confirmed? %> +
<%= t("admin.poll_booth_assignments.show.date") %><%= t("admin.poll_booth_assignments.show.count_by_system") %>
<%= l voting_date %><%= system_count %>
+ + + + - <% end %> - -
<%= t("admin.poll_booth_assignments.show.date") %><%= t("admin.poll_booth_assignments.show.count_by_system") %>
+ + + <% (@poll.starts_at.to_date..@poll.ends_at.to_date).each do |voting_date| %> + <% system_count = @voters_by_date[voting_date].present? ? @voters_by_date[voting_date].size : 0 %> + "> + <%= l voting_date %> + <%= system_count %> + + <% end %> + + + <% end %>
<%= render "results" %> diff --git a/spec/features/admin/poll/booth_assigments_spec.rb b/spec/features/admin/poll/booth_assigments_spec.rb index 39e292fcb..169956362 100644 --- a/spec/features/admin/poll/booth_assigments_spec.rb +++ b/spec/features/admin/poll/booth_assigments_spec.rb @@ -204,6 +204,26 @@ describe "Admin booths assignments" do end end + scenario "Doesn't show system recounts for old polls" do + poll = create(:poll, :old) + booth_assignment = create(:poll_booth_assignment, poll: poll) + + create(:poll_voter, poll: poll, booth_assignment: booth_assignment) + create(:poll_recount, booth_assignment: booth_assignment, total_amount: 10) + + visit admin_poll_booth_assignment_path(poll, booth_assignment) + + within("#totals") do + within("#total_final") do + expect(page).to have_content "10" + end + + expect(page).not_to have_selector "#total_system" + end + + expect(page).not_to have_selector "#recounts_list" + end + scenario "Results for a booth assignment" do poll = create(:poll) booth_assignment = create(:poll_booth_assignment, poll: poll)