diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index ecb3f190f..c86d04ad5 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -43,7 +43,6 @@ Layout/DotPosition:
- 'app/controllers/admin/poll/polls_controller.rb'
- 'app/controllers/admin/poll/recounts_controller.rb'
- 'app/controllers/officing/final_recounts_controller.rb'
- - 'app/controllers/officing/recounts_controller.rb'
- 'app/controllers/officing/residence_controller.rb'
- 'app/controllers/officing/results_controller.rb'
- 'app/models/poll/officer.rb'
@@ -193,7 +192,6 @@ Layout/MultilineMethodCallIndentation:
- 'app/controllers/admin/poll/polls_controller.rb'
- 'app/controllers/admin/poll/recounts_controller.rb'
- 'app/controllers/officing/final_recounts_controller.rb'
- - 'app/controllers/officing/recounts_controller.rb'
- 'app/controllers/officing/residence_controller.rb'
- 'app/controllers/officing/results_controller.rb'
- 'app/models/poll/officer.rb'
@@ -475,7 +473,6 @@ Style/ConditionalAssignment:
- 'app/controllers/comments_controller.rb'
- 'app/controllers/management/spending_proposals_controller.rb'
- 'app/controllers/officing/final_recounts_controller.rb'
- - 'app/controllers/officing/recounts_controller.rb'
- 'app/controllers/spending_proposals_controller.rb'
- 'app/controllers/verification/sms_controller.rb'
- 'lib/graph_ql/api_types_creator.rb'
diff --git a/app/controllers/officing/recounts_controller.rb b/app/controllers/officing/recounts_controller.rb
deleted file mode 100644
index b7ebf6acc..000000000
--- a/app/controllers/officing/recounts_controller.rb
+++ /dev/null
@@ -1,48 +0,0 @@
-class Officing::RecountsController < Officing::BaseController
- before_action :load_poll
- before_action :load_officer_assignment, only: :create
-
- def new
- @officer_assignments = ::Poll::OfficerAssignment.
- includes(:recount, booth_assignment: :booth).
- joins(:booth_assignment).
- voting_days.
- where(id: current_user.poll_officer.officer_assignment_ids).
- where("poll_booth_assignments.poll_id = ?", @poll.id).
- order(date: :asc)
- @recounted = @officer_assignments.select {|oa| oa.recount.present?}.reverse
- end
-
- def create
- @recount = ::Poll::Recount.find_or_initialize_by(booth_assignment_id: @officer_assignment.booth_assignment_id,
- date: @officer_assignment.date)
- @recount.officer_assignment_id = @officer_assignment.id
- @recount.count = recount_params[:count]
-
- if @recount.save
- msg = { notice: t("officing.recounts.flash.create") }
- else
- msg = { alert: t("officing.recounts.flash.error_create") }
- end
- redirect_to new_officing_poll_recount_path(@poll), msg
- end
-
- private
-
- def load_poll
- @poll = Poll.find(params[:poll_id])
- end
-
- def load_officer_assignment
- @officer_assignment = current_user.poll_officer.
- officer_assignments.find_by(id: recount_params[:officer_assignment_id])
- if @officer_assignment.blank?
- redirect_to new_officing_poll_recount_path(@poll), alert: t("officing.recounts.flash.error_create")
- end
- end
-
- def recount_params
- params.permit(:officer_assignment_id, :count)
- end
-
-end
diff --git a/app/helpers/officing_helper.rb b/app/helpers/officing_helper.rb
index 8ee97cf52..4e824b3f2 100644
--- a/app/helpers/officing_helper.rb
+++ b/app/helpers/officing_helper.rb
@@ -17,11 +17,6 @@ module OfficingHelper
options_for_select(options, params[:oa])
end
- def recount_to_compare_with_final_recount(final_recount)
- recount = final_recount.booth_assignment.recounts.select {|r| r.date == final_recount.date}.first
- recount.present? ? recount.count : "-"
- end
-
def system_recount_to_compare_with_final_recount(final_recount)
final_recount.booth_assignment.voters.select {|v| v.created_at.to_date == final_recount.date}.size
end
@@ -33,4 +28,4 @@ module OfficingHelper
params[:questions][question_id.to_s][answer_index.to_s]
end
-end
\ No newline at end of file
+end
diff --git a/app/views/officing/_menu.html.erb b/app/views/officing/_menu.html.erb
index 2d0d93cbd..1f8c2c56d 100644
--- a/app/views/officing/_menu.html.erb
+++ b/app/views/officing/_menu.html.erb
@@ -8,13 +8,6 @@
<% end %>
-
>
- <%= link_to officing_polls_path do %>
-
- <%= t("officing.menu.recounts") %>
- <% end %>
-
-
>
<%= link_to final_officing_polls_path do %>
diff --git a/app/views/officing/polls/index.html.erb b/app/views/officing/polls/index.html.erb
deleted file mode 100644
index 8f3e4921e..000000000
--- a/app/views/officing/polls/index.html.erb
+++ /dev/null
@@ -1,30 +0,0 @@
-<%= t("officing.polls.index.title") %>
-
-<% if @polls.any? %>
-
-
- <%= t("officing.polls.index.select_poll") %>
-
-
-
- <% @polls.each do |poll| %>
-
-
-
- <%= link_to poll.name, new_officing_poll_recount_path(poll) %>
-
-
-
- <%= link_to t("officing.polls.index.add_recount"),
- new_officing_poll_recount_path(poll),
- class: "button hollow" %>
-
-
- <% end %>
-
-
-<% else %>
-
- <%= t("officing.polls.index.no_polls") %>
-
-<% end %>
\ No newline at end of file
diff --git a/app/views/officing/recounts/new.html.erb b/app/views/officing/recounts/new.html.erb
deleted file mode 100644
index dc78ccf89..000000000
--- a/app/views/officing/recounts/new.html.erb
+++ /dev/null
@@ -1,63 +0,0 @@
-<% if @officer_assignments.any? %>
- <%= t("officing.recounts.new.title", poll: @poll.name) %>
-
- <%= form_tag(officing_poll_recounts_path(@poll), {id: "officer_assignment_form"}) do %>
-
-
-
- <%= t("officing.recounts.new.booth_date") %>
- <%= select_tag :officer_assignment_id,
- officer_assignments_select_options(@officer_assignments),
- { prompt: t("officing.recounts.new.select_booth_date"),
- label: false } %>
-
-
-
-
-
- <%= t("officing.recounts.new.count") %>
- <%= text_field_tag :count, nil, placeholder: t("officing.recounts.new.count_placeholder") %>
-
-
-
-
-
- <%= submit_tag t("officing.recounts.new.submit"), class: "button expanded" %>
-
-
- <% end %>
-<% else %>
- <%= @poll.name %>
-
- <%= t("officing.recounts.new.not_allowed") %>
-
-<% end %>
-
-
-<% if @recounted.any? %>
-
- <%= t("officing.recounts.new.recount_list") %>
-
-
-
- <%= t("officing.recounts.new.date") %>
- <%= t("officing.recounts.new.booth") %>
- <%= t("officing.recounts.new.count") %>
-
-
- <% @recounted.each do |oa| %>
-
-
- <%= l(oa.date.to_date, format: :long) %>
-
-
- <%= oa.booth_assignment.booth.name %>
-
-
- <%= oa.recount.count %>
-
-
- <% end %>
-
-
-<% end %>
diff --git a/config/locales/en/officing.yml b/config/locales/en/officing.yml
index ffda9d326..897c51b2a 100644
--- a/config/locales/en/officing.yml
+++ b/config/locales/en/officing.yml
@@ -9,35 +9,14 @@ en:
info: Here you can validate user documents and store voting results
menu:
voters: Validate document
- recounts: Store recount
final_recounts: Final recounts and results
polls:
- index:
- title: Poll list
- no_polls: You are not officing in any active poll
- select_poll: Select poll
- add_recount: Add recount
final:
title: Polls ready for final recounting
no_polls: You are not officing final recounts in any active poll
select_poll: Select poll
add_recount: Add final recount
add_results: Add results
- recounts:
- flash:
- create: "Data added"
- error_create: "Count NOT added. Error in data."
- new:
- title: "%{poll} - Add daily recount"
- not_allowed: "You are not a poll officer for this poll"
- booth_date: "Booth and date"
- select_booth_date: "Select booth and date"
- count: "Vote count"
- count_placeholder: "Vote count"
- submit: Save
- recount_list: "Your recounts"
- booth: "Booth"
- date: "Date"
final_recounts:
flash:
create: "Data added"
diff --git a/config/locales/es/officing.yml b/config/locales/es/officing.yml
index 7958b64b0..bd18f1ca7 100644
--- a/config/locales/es/officing.yml
+++ b/config/locales/es/officing.yml
@@ -9,35 +9,14 @@ es:
info: Aquí puedes validar documentos de ciudadanos y guardar los resultados de las urnas
menu:
voters: "Validar documento y votar"
- recounts: "Recuento diario"
final_recounts: "Recuento final y escrutinio"
polls:
- index:
- title: "Listado de votaciones"
- no_polls: "No eres presidente de mesa en ninguna votación activa"
- select_poll: "Selecciona votación"
- add_recount: "Añadir recuento"
final:
title: "Listado de votaciones finalizadas"
no_polls: "No tienes permiso para recuento final en ninguna votación reciente"
select_poll: "Selecciona votación"
add_recount: "Añadir recuentos finales"
add_results: "Añadir resultados"
- recounts:
- flash:
- create: "Datos añadidos"
- error_create: "Recuento NO añadido. Error en los datos"
- new:
- title: "%{poll} - Añadir recuento diario"
- not_allowed: "No eres presidente de mesa en esta votación"
- booth_date: "Fecha y urna"
- select_booth_date: "Elige fecha y urna"
- count: "Número de votos"
- count_placeholder: "Número de votos"
- submit: "Guardar"
- recount_list: "Tus recuentos"
- booth: "Urna"
- date: "Fecha"
final_recounts:
flash:
create: "Datos añadidos"
diff --git a/config/routes.rb b/config/routes.rb
index aaa9b5db7..d151fdb6c 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -400,7 +400,6 @@ Rails.application.routes.draw do
resources :polls, only: [:index] do
get :final, on: :collection
- resources :recounts, only: [:new, :create]
resources :final_recounts, only: [:new, :create]
resources :results, only: [:new, :create, :index]
end
diff --git a/spec/features/officing/recount_spec.rb b/spec/features/officing/recount_spec.rb
deleted file mode 100644
index a7d74d0be..000000000
--- a/spec/features/officing/recount_spec.rb
+++ /dev/null
@@ -1,87 +0,0 @@
-require 'rails_helper'
-
-feature 'Officing Recount' do
-
- background do
- @poll_officer = create(:poll_officer)
- @officer_assignment = create(:poll_officer_assignment, officer: @poll_officer)
- @poll = @officer_assignment.booth_assignment.poll
- login_as(@poll_officer.user)
- end
-
- scenario 'Only polls where user is officer are accessible' do
- not_allowed_poll = create(:poll)
-
- visit root_path
- click_link 'Polling officers'
-
- expect(page).to have_content('Poll officing')
- within('#side_menu') do
- click_link 'Store recount'
- end
-
- expect(page).to_not have_content(not_allowed_poll.name)
- expect(page).to have_content(@poll.name)
-
- visit new_officing_poll_recount_path(not_allowed_poll)
- expect(page).to have_content('You are not a poll officer for this poll')
- end
-
- scenario 'Add recount' do
- visit officing_root_path
-
- within('#side_menu') do
- click_link 'Store recount'
- end
-
- click_link @poll.name
-
- expect(page).to_not have_content('Your recounts')
-
- booth_name = @officer_assignment.booth_assignment.booth.name
- date = I18n.l(@officer_assignment.date.to_date, format: :long)
- select "#{booth_name}: #{date}", from: 'officer_assignment_id'
- fill_in :count, with: '33'
- click_button 'Save'
-
- expect(page).to have_content('Your recounts')
-
- within("#poll_recount_#{@officer_assignment.booth_assignment.recounts.first.id}") do
- expect(page).to have_content(date)
- expect(page).to have_content(booth_name)
- expect(page).to have_content('33')
- end
- end
-
- scenario 'Edit recount' do
- recount = create(:poll_recount,
- officer_assignment: @officer_assignment,
- booth_assignment: @officer_assignment.booth_assignment,
- date: @officer_assignment.date,
- count: 100)
-
- booth_name = @officer_assignment.booth_assignment.booth.name
- date = I18n.l(@officer_assignment.date.to_date, format: :long)
-
- visit new_officing_poll_recount_path(@poll)
-
- expect(page).to have_content('Your recounts')
-
- within("#poll_recount_#{recount.id}") do
- expect(page).to have_content(date)
- expect(page).to have_content(booth_name)
- expect(page).to have_content('100')
- end
-
- select "#{booth_name}: #{date}", from: 'officer_assignment_id'
- fill_in :count, with: '42'
- click_button 'Save'
-
- within("#poll_recount_#{recount.id}") do
- expect(page).to have_content(date)
- expect(page).to have_content(booth_name)
- expect(page).to have_content('42')
- end
- expect(page).to_not have_content('100')
- end
-end
\ No newline at end of file