| <%= 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_results.any? %>
+ <%= officer_assignment.total_results.to_a.sum(&:amount) %>
<% else %>
-
<% end %>
diff --git a/app/views/admin/poll/recounts/index.html.erb b/app/views/admin/poll/recounts/index.html.erb
index 159b4b120..ff4e7bceb 100644
--- a/app/views/admin/poll/recounts/index.html.erb
+++ b/app/views/admin/poll/recounts/index.html.erb
@@ -12,12 +12,12 @@
| <%= t("admin.recounts.index.table_booth_name") %> |
- <%= t("admin.recounts.index.table_final_recount") %> |
+ <%= t("admin.recounts.index.table_total_recount") %> |
<%= t("admin.recounts.index.table_system_count") %> |
<% @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 %>
|
@@ -25,9 +25,9 @@
<%= link_to booth_assignment.booth.name, admin_poll_booth_assignment_path(@poll, booth_assignment, anchor: 'tab-recounts') %>
|
-
- <% if final_recount.present? %>
- <%= final_recount %>
+ |
+ <% if total_recounts.present? %>
+ <%= total_recounts %>
<% 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 91b493ffa..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"
@@ -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"
@@ -604,7 +604,7 @@ en:
title: "Recounts"
no_recounts: "There is nothing to be recounted"
table_booth_name: "Booth"
- table_final_recount: "Final recount (by officer)"
+ table_total_recount: "Total recount (by officer)"
table_system_count: "Votes (automatic)"
results:
index:
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 2db094999..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"
@@ -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"
@@ -604,7 +604,7 @@ es:
title: "Recuentos"
no_recounts: "No hay nada de lo que hacer recuento"
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)"
results:
index:
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 0044a276f..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é"
@@ -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"
@@ -391,7 +391,7 @@ fr:
no_recounts: "Il n'y a rien à dépouiller"
table_booth_name: "Bureau de vote"
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)"
results:
index:
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 a359aebbe..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"
@@ -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"
@@ -391,7 +391,7 @@ nl:
no_recounts: "There is nothing to be recounted"
table_booth_name: "Booth"
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)"
results:
index:
diff --git a/config/locales/nl/officing.yml b/config/locales/nl/officing.yml
index 08be19335..e68f7e488 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: Total 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"
diff --git a/db/migrate/20170918231410_remove_poll_final_recounts.rb b/db/migrate/20170918231410_remove_poll_final_recounts.rb
new file mode 100644
index 000000000..369a959bb
--- /dev/null
+++ b/db/migrate/20170918231410_remove_poll_final_recounts.rb
@@ -0,0 +1,11 @@
+class RemovePollFinalRecounts < ActiveRecord::Migration
+ def change
+ remove_index :poll_final_recounts, column: :booth_assignment_id
+ remove_index :poll_final_recounts, column: :officer_assignment_id
+
+ remove_foreign_key :poll_final_recounts, column: "booth_assignment_id"
+ remove_foreign_key :poll_final_recounts, column: "officer_assignment_id"
+
+ drop_table :poll_final_recounts
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 45598ff4e..240abcdaa 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20170914154743) do
+ActiveRecord::Schema.define(version: 20170918231410) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -586,20 +586,6 @@ ActiveRecord::Schema.define(version: 20170914154743) do
t.string "location"
end
- create_table "poll_final_recounts", force: :cascade do |t|
- t.integer "booth_assignment_id"
- t.integer "officer_assignment_id"
- t.integer "count"
- t.text "count_log", default: ""
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.text "officer_assignment_id_log", default: ""
- t.date "date", null: false
- end
-
- add_index "poll_final_recounts", ["booth_assignment_id"], name: "index_poll_final_recounts_on_booth_assignment_id", using: :btree
- add_index "poll_final_recounts", ["officer_assignment_id"], name: "index_poll_final_recounts_on_officer_assignment_id", using: :btree
-
create_table "poll_null_results", force: :cascade do |t|
t.integer "author_id"
t.integer "amount"
@@ -1101,8 +1087,6 @@ ActiveRecord::Schema.define(version: 20170914154743) do
add_foreign_key "organizations", "users"
add_foreign_key "poll_answers", "poll_questions", column: "question_id"
add_foreign_key "poll_booth_assignments", "polls"
- add_foreign_key "poll_final_recounts", "poll_booth_assignments", column: "booth_assignment_id"
- add_foreign_key "poll_final_recounts", "poll_officer_assignments", column: "officer_assignment_id"
add_foreign_key "poll_null_results", "poll_booth_assignments", column: "booth_assignment_id"
add_foreign_key "poll_null_results", "poll_officer_assignments", column: "officer_assignment_id"
add_foreign_key "poll_officer_assignments", "poll_booth_assignments", column: "booth_assignment_id"
diff --git a/spec/factories.rb b/spec/factories.rb
index b1c6e7174..b90f68175 100644
--- a/spec/factories.rb
+++ b/spec/factories.rb
@@ -507,13 +507,6 @@ FactoryGirl.define do
date Date.current
end
- factory :poll_final_recount, class: 'Poll::FinalRecount' do
- association :officer_assignment, factory: [:poll_officer_assignment, :final]
- association :booth_assignment, factory: :poll_booth_assignment
- count (1..100).to_a.sample
- date (1.month.ago.to_datetime..1.month.from_now.to_datetime).to_a.sample
- end
-
factory :poll_voter, class: 'Poll::Voter' do
poll
association :user, :level_two
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
diff --git a/spec/features/admin/poll/polls_spec.rb b/spec/features/admin/poll/polls_spec.rb
index 13ec0db58..6eb64f6e1 100644
--- a/spec/features/admin/poll/polls_spec.rb
+++ b/spec/features/admin/poll/polls_spec.rb
@@ -249,18 +249,18 @@ feature 'Admin polls' do
booth_assignment_final_recounted = create(:poll_booth_assignment, poll: poll)
3.times do |i|
- create(:poll_final_recount,
+ create(:poll_total_result,
booth_assignment: booth_assignment,
date: poll.starts_at + i.days,
- count: 21)
+ amount: 21)
end
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,
date: poll.ends_at,
- count: 55555)
+ amount: 55555)
visit admin_poll_path(poll)
diff --git a/spec/features/officing/results_spec.rb b/spec/features/officing/results_spec.rb
index 676ac7d68..835903ab9 100644
--- a/spec/features/officing/results_spec.rb
+++ b/spec/features/officing/results_spec.rb
@@ -26,7 +26,7 @@ feature 'Officing Results' do
expect(page).to have_content('Poll officing')
within('#side_menu') do
- click_link 'Final recounts and results'
+ click_link 'Total recounts and results'
end
expect(page).to_not have_content(not_allowed_poll_1.name)
@@ -42,7 +42,7 @@ feature 'Officing Results' do
visit officing_root_path
within('#side_menu') do
- click_link 'Final recounts and results'
+ click_link 'Total recounts and results'
end
within("#poll_#{@poll.id}") do
diff --git a/spec/models/poll/final_recount_spec.rb b/spec/models/poll/final_recount_spec.rb
deleted file mode 100644
index bccd772ca..000000000
--- a/spec/models/poll/final_recount_spec.rb
+++ /dev/null
@@ -1,40 +0,0 @@
-require 'rails_helper'
-
-describe :final_recount do
-
- it "should update count_log if count changes" do
- final_recount = create(:poll_final_recount, count: 33)
-
- expect(final_recount.count_log).to eq("")
-
- final_recount.count = 33
- final_recount.save
- final_recount.count = 32
- final_recount.save
- final_recount.count = 34
- final_recount.save
-
- expect(final_recount.count_log).to eq(":33:32")
- end
-
- it "should update officer_assignment_id_log if count changes" do
- final_recount = create(:poll_final_recount, count: 33)
-
- expect(final_recount.count_log).to eq("")
-
- final_recount.count = 33
- final_recount.officer_assignment = create(:poll_officer_assignment, id: 111)
- final_recount.save
-
- final_recount.count = 32
- final_recount.officer_assignment = create(:poll_officer_assignment, id: 112)
- final_recount.save
-
- final_recount.count = 34
- final_recount.officer_assignment = create(:poll_officer_assignment, id: 113)
- final_recount.save
-
- expect(final_recount.officer_assignment_id_log).to eq(":111:112")
- end
-
-end
\ No newline at end of file
| |