diff --git a/app/controllers/admin/poll/booth_assignments_controller.rb b/app/controllers/admin/poll/booth_assignments_controller.rb index 358f26a65..e8f7b9134 100644 --- a/app/controllers/admin/poll/booth_assignments_controller.rb +++ b/app/controllers/admin/poll/booth_assignments_controller.rb @@ -15,7 +15,7 @@ class Admin::Poll::BoothAssignmentsController < Admin::BaseController end def show - @booth_assignment = @poll.booth_assignments.includes(:final_recounts, :voters, + @booth_assignment = @poll.booth_assignments.includes(:total_results, :voters, officer_assignments: [officer: [:user]]).find(params[:id]) @voters_by_date = @booth_assignment.voters.group_by {|v| v.created_at.to_date} end diff --git a/app/controllers/admin/poll/officer_assignments_controller.rb b/app/controllers/admin/poll/officer_assignments_controller.rb index 45c9a225a..b7068977b 100644 --- a/app/controllers/admin/poll/officer_assignments_controller.rb +++ b/app/controllers/admin/poll/officer_assignments_controller.rb @@ -18,7 +18,7 @@ class Admin::Poll::OfficerAssignmentsController < Admin::BaseController @officer = ::Poll::Officer.includes(:user).find(officer_assignment_params[:officer_id]) @officer_assignments = ::Poll::OfficerAssignment. joins(:booth_assignment). - includes(:final_recounts, booth_assignment: :booth). + includes(:total_results, booth_assignment: :booth). where("officer_id = ? AND poll_booth_assignments.poll_id = ?", @officer.id, @poll.id). order(:date) end diff --git a/app/controllers/admin/poll/recounts_controller.rb b/app/controllers/admin/poll/recounts_controller.rb index 57289a207..082343e31 100644 --- a/app/controllers/admin/poll/recounts_controller.rb +++ b/app/controllers/admin/poll/recounts_controller.rb @@ -3,7 +3,7 @@ class Admin::Poll::RecountsController < Admin::BaseController def index @booth_assignments = @poll.booth_assignments. - includes(:booth, :final_recounts, :voters). + includes(:booth, :total_results, :voters). order("poll_booths.name"). page(params[:page]).per(50) end diff --git a/app/models/poll/booth_assignment.rb b/app/models/poll/booth_assignment.rb index 47cb01bfe..8b4b655ef 100644 --- a/app/models/poll/booth_assignment.rb +++ b/app/models/poll/booth_assignment.rb @@ -4,7 +4,6 @@ class Poll belongs_to :poll has_many :officer_assignments, class_name: "Poll::OfficerAssignment", dependent: :destroy - has_many :final_recounts, class_name: "Poll::FinalRecount", dependent: :destroy has_many :officers, through: :officer_assignments has_many :voters has_many :partial_results diff --git a/app/models/poll/officer_assignment.rb b/app/models/poll/officer_assignment.rb index 1d7326500..8e86d309c 100644 --- a/app/models/poll/officer_assignment.rb +++ b/app/models/poll/officer_assignment.rb @@ -2,8 +2,10 @@ class Poll class OfficerAssignment < ActiveRecord::Base belongs_to :officer belongs_to :booth_assignment - has_many :final_recounts has_many :partial_results + has_many :white_results + has_many :null_results + has_many :total_results has_many :voters validates :officer_id, presence: true diff --git a/app/views/admin/poll/officer_assignments/by_officer.html.erb b/app/views/admin/poll/officer_assignments/by_officer.html.erb index 8cc6c0437..afc674769 100644 --- a/app/views/admin/poll/officer_assignments/by_officer.html.erb +++ b/app/views/admin/poll/officer_assignments/by_officer.html.erb @@ -31,23 +31,23 @@ <% final_officer_assignments = @officer_assignments.select{|oa| oa.final == true} %> <% if final_officer_assignments.any? %> -

<%= t("admin.poll_officer_assignments.by_officer.final_recounts") %>

- +

<%= t("admin.poll_officer_assignments.by_officer.total_recounts") %>

+
- + <% final_officer_assignments.each do |officer_assignment| %> - +
<%= t("admin.poll_officer_assignments.by_officer.date") %> <%= t("admin.poll_officer_assignments.by_officer.booth") %><%= t("admin.poll_officer_assignments.by_officer.final_recount") %><%= t("admin.poll_officer_assignments.by_officer.total_recount") %>
<%= l(officer_assignment.date.to_date) %> <%= booth_name_with_location(officer_assignment.booth_assignment.booth) %> - <% if officer_assignment.final_recounts.any? %> - <%= officer_assignment.final_recounts.to_a.sum(&:count) %> + <% if officer_assignment.total_recounts.any? %> + <%= officer_assignment.total_recounts.to_a.sum(&:amount) %> <% else %> - <% end %> diff --git a/app/views/officing/_menu.html.erb b/app/views/officing/_menu.html.erb index 1f8c2c56d..c96fd8c07 100644 --- a/app/views/officing/_menu.html.erb +++ b/app/views/officing/_menu.html.erb @@ -8,10 +8,10 @@ <% end %> -
  • > +
  • > <%= link_to final_officing_polls_path do %> - <%= t("officing.menu.final_recounts") %> + <%= t("officing.menu.total_recounts") %> <% end %>
  • diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index 63fb7c70c..d9b91b01c 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -494,8 +494,8 @@ en: booth: "Booth" assignments: "Officing shifts in this poll" no_assignments: "This user has no officing shifts in this poll." - final_recounts: "Final recounts" - final_recount: "Final recount (by officer)" + total_recounts: "Total recounts" + total_recount: "Total recount (by officer)" poll_shifts: new: add_shift: "Add shift" diff --git a/config/locales/en/officing.yml b/config/locales/en/officing.yml index 72b3812ea..2dfc29ac3 100644 --- a/config/locales/en/officing.yml +++ b/config/locales/en/officing.yml @@ -9,7 +9,7 @@ en: info: Here you can validate user documents and store voting results menu: voters: Validate document - final_recounts: Final recounts and results + total_recounts: Total recounts and results polls: final: title: Polls ready for final recounting diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index 0e1f0db65..5f8c73341 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -494,8 +494,8 @@ es: booth: "Urna" assignments: "Turnos como presidente de mesa en esta votación" no_assignments: "No tiene turnos como presidente de mesa en esta votación." - final_recounts: "Recuentos finales" - final_recount: "Recuento final (presidente de mesa)" + total_recounts: "Recuentos totales" + total_recount: "Recuento total (presidente de mesa)" poll_shifts: new: add_shift: "Añadir turno" diff --git a/config/locales/es/officing.yml b/config/locales/es/officing.yml index 81dd70492..74358ab56 100644 --- a/config/locales/es/officing.yml +++ b/config/locales/es/officing.yml @@ -9,7 +9,7 @@ es: info: Aquí puedes validar documentos de ciudadanos y guardar los resultados de las urnas menu: voters: "Validar documento y votar" - final_recounts: "Recuento final y escrutinio" + total_recounts: "Recuento total y escrutinio" polls: final: title: "Listado de votaciones finalizadas" diff --git a/config/locales/fr/admin.yml b/config/locales/fr/admin.yml index 966563b7c..ae9a44277 100644 --- a/config/locales/fr/admin.yml +++ b/config/locales/fr/admin.yml @@ -301,8 +301,8 @@ fr: no_assignments: "Cet utilisateur n'a pas d'affectation pour ce vote." recounts: "Dépouillement journalier" recount: "Dépouillement journalier (par président)" - final_recounts: "Dépouillement final" - final_recount: "Dépouillement final (par président)" + total_recounts: "Dépouillement final" + total_recount: "Dépouillement final (par président)" poll_booth_assignments: flash: destroy: "Ce bureau de vote n'est plus affecté" diff --git a/config/locales/fr/officing.yml b/config/locales/fr/officing.yml index c0e3d4284..c660b49f1 100644 --- a/config/locales/fr/officing.yml +++ b/config/locales/fr/officing.yml @@ -10,7 +10,7 @@ fr: menu: voters: "Valider un document" recounts: "Enregistrer le dépouillement" - final_recounts: "Dépouillements finaux et résultats" + total_recounts: "Dépouillements finaux et résultats" polls: index: title: "Liste des votes" @@ -38,23 +38,6 @@ fr: recount_list: "Vos dépouillements" booth: "Urne" date: "Date" - final_recounts: - flash: - create: "Données ajoutées" - error_create: "Décompte final NON ajouté. Erreur dans les données." - new: - title: "%{poll} - Ajouter le dépouillement final" - not_allowed: "Vous n'êtes pas autorisés à ajouter les dépouillements finaux pour ce vote" - booth: "Bureau de vote" - date: "Date" - select_booth: "Sélectionner un bureau de vote" - select_date: "Sélectionner une date" - count: "Décompte final des votes" - count_placeholder: "Décompte final des votes" - submit: "Sauvegarder" - final_recount_list: "Vos dépouillements finaux" - system_count: "Dépouillement par le système" - add_results: "Ajouter les résultats" results: flash: create: "Résultats sauvegardés" diff --git a/config/locales/nl/admin.yml b/config/locales/nl/admin.yml index c7d77cda9..8a30b0d21 100644 --- a/config/locales/nl/admin.yml +++ b/config/locales/nl/admin.yml @@ -301,8 +301,8 @@ nl: no_assignments: "This user has no officing shifts in this poll." recounts: "Daily recounts" recount: "Daily recount (by officer)" - final_recounts: "Final recounts" - final_recount: "Final recount (by officer)" + total_recounts: "Final recounts" + total_recount: "Final recount (by officer)" poll_booth_assignments: flash: destroy: "Booth not assigned anymore" diff --git a/config/locales/nl/officing.yml b/config/locales/nl/officing.yml index 08be19335..810a354b5 100644 --- a/config/locales/nl/officing.yml +++ b/config/locales/nl/officing.yml @@ -10,7 +10,7 @@ nl: menu: voters: Validate document recounts: Store recount - final_recounts: Final recounts and results + total_recounts: Final recounts and results polls: index: title: Poll list @@ -38,23 +38,6 @@ nl: recount_list: "Your recounts" booth: "Booth" date: "Date" - final_recounts: - flash: - create: "Data added" - error_create: "Final counts NOT added. Error in data." - new: - title: "%{poll} - Add final recount" - not_allowed: "You are allowed to add final recounts for this poll" - booth: "Booth" - date: "Date" - select_booth: "Select booth" - select_date: "Select date" - count: "Final vote count" - count_placeholder: "Final vote count" - submit: Save - final_recount_list: "Your final recounts" - system_count: "System recount" - add_results: "Add results" results: flash: create: "Results saved"