diff --git a/app/helpers/officers_helper.rb b/app/helpers/officers_helper.rb
index f29bcf728..31c0a6ad4 100644
--- a/app/helpers/officers_helper.rb
+++ b/app/helpers/officers_helper.rb
@@ -4,4 +4,12 @@ module OfficersHelper
truncate([officer.name, officer.email].compact.join(' - '), length: 100)
end
-end
\ No newline at end of file
+ def vote_collection_shift?
+ current_user.poll_officer.officer_assignments.where(date: Time.current.to_date).any?
+ end
+
+ def final_recount_shift?
+ current_user.poll_officer.officer_assignments.final.where(date: Time.current.to_date).any?
+ end
+
+end
diff --git a/app/views/officing/_menu.html.erb b/app/views/officing/_menu.html.erb
index e954d2195..173c72582 100644
--- a/app/views/officing/_menu.html.erb
+++ b/app/views/officing/_menu.html.erb
@@ -1,18 +1,21 @@
diff --git a/app/views/officing/dashboard/index.html.erb b/app/views/officing/dashboard/index.html.erb
index 861a39b1a..87ee59926 100644
--- a/app/views/officing/dashboard/index.html.erb
+++ b/app/views/officing/dashboard/index.html.erb
@@ -2,4 +2,10 @@
<%= t("officing.dashboard.index.title") %>
<%= t("officing.dashboard.index.info") %>
+
+ <% unless final_recount_shift? && vote_collection_shift? %>
+
+ <%= t("officing.dashboard.index.no_shifts") %>
+
+ <% end %>
diff --git a/config/locales/en/officing.yml b/config/locales/en/officing.yml
index 42003da98..d3e827057 100644
--- a/config/locales/en/officing.yml
+++ b/config/locales/en/officing.yml
@@ -6,6 +6,7 @@ en:
index:
title: Poll officing
info: Here you can validate user documents and store voting results
+ no_shifts: You don't have officing shifts today.
menu:
voters: Validate document
total_recounts: Total recounts and results
diff --git a/config/locales/es/officing.yml b/config/locales/es/officing.yml
index 6832311a7..33a015667 100644
--- a/config/locales/es/officing.yml
+++ b/config/locales/es/officing.yml
@@ -6,6 +6,7 @@ es:
index:
title: Presidir mesa de votaciones
info: AquĆ puedes validar documentos de ciudadanos y guardar los resultados de las urnas
+ no_shifts: No tienes turnos de presidente de mesa asignados hoy.
menu:
voters: Validar documento y votar
total_recounts: Recuento total y escrutinio
diff --git a/spec/features/budget_polls/officing_spec.rb b/spec/features/budget_polls/officing_spec.rb
new file mode 100644
index 000000000..8d3e9501a
--- /dev/null
+++ b/spec/features/budget_polls/officing_spec.rb
@@ -0,0 +1,40 @@
+require 'rails_helper'
+
+feature 'Budget Poll Officing' do
+
+ scenario 'Show sidebar menu if officer has shifts assigned' do
+ budget = create(:budget)
+ poll = create(:poll, budget: budget)
+ booth = create(:poll_booth)
+ booth_assignment = create(:poll_booth_assignment, poll: poll, booth: booth)
+
+ user = create(:user)
+ officer = create(:poll_officer, user: user)
+
+ create(:poll_shift, officer: officer, booth: booth, date: Date.current, task: :recount_scrutiny)
+
+ officer_assignment = create(:poll_officer_assignment,
+ booth_assignment: booth_assignment,
+ officer: officer)
+
+ login_as user
+ visit officing_root_path
+
+ expect(page).not_to have_content("You don't have officing shifts today")
+ expect(page).to have_content("Validate document")
+ expect(page).to have_content("Total recounts and results")
+ end
+
+ scenario 'Do not show sidebar menu if officer has no shifts assigned' do
+ user = create(:user)
+ officer = create(:poll_officer, user: user)
+
+ login_as user
+ visit officing_root_path
+
+ expect(page).to have_content("You don't have officing shifts today")
+ expect(page).not_to have_content("Validate document")
+ expect(page).not_to have_content("Total recounts and results")
+ end
+
+end
\ No newline at end of file
diff --git a/spec/features/officing/residence_spec.rb b/spec/features/officing/residence_spec.rb
index 67f84d6d6..473a3a979 100644
--- a/spec/features/officing/residence_spec.rb
+++ b/spec/features/officing/residence_spec.rb
@@ -9,10 +9,7 @@ feature 'Residence' do
login_as(officer.user)
visit officing_root_path
- within("#side_menu") do
- click_link "Validate document"
- end
-
+ expect(page).not_to have_link("Validate document")
expect(page).to have_content("You don't have officing shifts today")
create(:poll_officer_assignment, officer: officer, date: 1.day.from_now)