From f27fcc7f9937cda8b75af27d6a6dd0c19e7c1b1a Mon Sep 17 00:00:00 2001 From: Bertocq Date: Mon, 18 Sep 2017 20:49:34 +0200 Subject: [PATCH] Replace FinalResult with TotalResult at admin BoothAssignment show --- app/helpers/poll_final_recounts_helper.rb | 7 ------- app/views/admin/poll/booth_assignments/show.html.erb | 8 ++++---- config/locales/en/admin.yml | 2 +- config/locales/es/admin.yml | 2 +- config/locales/fr/admin.yml | 2 +- config/locales/nl/admin.yml | 2 +- spec/features/admin/poll/booth_assigments_spec.rb | 8 ++++---- 7 files changed, 12 insertions(+), 19 deletions(-) delete mode 100644 app/helpers/poll_final_recounts_helper.rb diff --git a/app/helpers/poll_final_recounts_helper.rb b/app/helpers/poll_final_recounts_helper.rb deleted file mode 100644 index e196cb65b..000000000 --- a/app/helpers/poll_final_recounts_helper.rb +++ /dev/null @@ -1,7 +0,0 @@ -module PollFinalRecountsHelper - - def final_recount_for_date(final_recounts, date) - final_recounts.select {|f| f.date == date}.first - end - -end \ No newline at end of file diff --git a/app/views/admin/poll/booth_assignments/show.html.erb b/app/views/admin/poll/booth_assignments/show.html.erb index 5b3ca41ab..b6917bca6 100644 --- a/app/views/admin/poll/booth_assignments/show.html.erb +++ b/app/views/admin/poll/booth_assignments/show.html.erb @@ -49,18 +49,18 @@ <%= t("admin.poll_booth_assignments.show.date") %> - <%= t("admin.poll_booth_assignments.show.count_final") %> + <%= t("admin.poll_booth_assignments.show.total_recount") %> <%= t("admin.poll_booth_assignments.show.count_by_system") %> <% (@poll.starts_at.to_date..@poll.ends_at.to_date).each do |voting_date| %> - <% final_recount = final_recount_for_date(@booth_assignment.final_recounts, 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 %> <%= l voting_date %> - <% if final_recount.present? %> - <%= final_recount.count %> + <% if total_recount.present? %> + <%= total_recount.amount %> <% else %> - <% end %> diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index 91b493ffa..6e01fdccf 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -531,7 +531,7 @@ en: recounts: "Recounts" recounts_list: "Recount list for this booth" date: "Date" - count_final: "Final recount (by officer)" + total_recount: "Total recount (by officer)" count_by_system: "Votes (automatic)" index: booths_title: "List of booths" diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index 2db094999..6bf881d30 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -531,7 +531,7 @@ es: recounts: "Recuentos" recounts_list: "Lista de recuentos de esta urna" date: "Fecha" - count_final: "Recuento final (presidente de mesa)" + total_recount: "Recuento total (presidente de mesa)" count_by_system: "Votos (automático)" index: booths_title: "Listado de urnas asignadas" diff --git a/config/locales/fr/admin.yml b/config/locales/fr/admin.yml index 0044a276f..a34862475 100644 --- a/config/locales/fr/admin.yml +++ b/config/locales/fr/admin.yml @@ -319,7 +319,7 @@ fr: no_recounts: "Il n'y a pas encore de dépouillements journaliers pour ce bureau de vote." date: "Date" count_by_officer: "Dépouillement journalier (par président)" - count_final: "Dépouillement final (par président)" + total_count: "Dépouillement final (par président)" count_by_system: "Votes (automatique)" index: booths_title: "Liste des bureaux de vote" diff --git a/config/locales/nl/admin.yml b/config/locales/nl/admin.yml index a359aebbe..2949f70f4 100644 --- a/config/locales/nl/admin.yml +++ b/config/locales/nl/admin.yml @@ -319,7 +319,7 @@ nl: no_recounts: "There are not daily recounts of this booth yet" date: "Date" count_by_officer: "Daily recount (by officer)" - count_final: "Final recount (by officer)" + total_count: "Final recount (by officer)" count_by_system: "Votes (automatic)" index: booths_title: "List of booths" diff --git a/spec/features/admin/poll/booth_assigments_spec.rb b/spec/features/admin/poll/booth_assigments_spec.rb index bcc27310f..09a21dd72 100644 --- a/spec/features/admin/poll/booth_assigments_spec.rb +++ b/spec/features/admin/poll/booth_assigments_spec.rb @@ -97,11 +97,11 @@ feature 'Admin booths assignments' do 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_recount = create(:poll_final_recount, + total_recount = create(:poll_total_result, booth_assignment: booth_assignment, officer_assignment: final_officer_assignment, date: final_officer_assignment.date, - count: 5678) + amount: 5678) booth_assignment_2 = create(:poll_booth_assignment, poll: poll) @@ -112,8 +112,8 @@ feature 'Admin booths assignments' do click_link 'Recounts' within('#recounts_list') do - within("#recounting_#{final_recount.date.strftime('%Y%m%d')}") do - expect(page).to have_content final_recount.count + within("#recounting_#{total_recount.date.strftime('%Y%m%d')}") do + expect(page).to have_content total_recount.amount end end end