diff --git a/app/components/admin/poll/shifts/form_component.html.erb b/app/components/admin/poll/shifts/form_component.html.erb
index 0d72452ab..8c0ad752a 100644
--- a/app/components/admin/poll/shifts/form_component.html.erb
+++ b/app/components/admin/poll/shifts/form_component.html.erb
@@ -22,11 +22,11 @@
<%= select "shift[date]", "vote_collection_date",
- options_for_select(shift_vote_collection_dates(voting_polls)),
+ options_for_select(shift_vote_collection_dates),
{ prompt: voting_polls.present? ? t("admin.poll_shifts.new.select_date") : t("admin.poll_shifts.new.no_voting_days") },
class: "js-shift-vote-collection-dates" %>
<%= select "shift[date]", "recount_scrutiny_date",
- options_for_select(shift_recount_scrutiny_dates(recount_polls)),
+ options_for_select(shift_recount_scrutiny_dates),
{ prompt: t("admin.poll_shifts.new.select_date") },
class: "js-shift-recount-scrutiny-dates",
hidden: "hidden" %>
diff --git a/app/components/admin/poll/shifts/form_component.rb b/app/components/admin/poll/shifts/form_component.rb
index cd7a0b2f2..5a0c626ba 100644
--- a/app/components/admin/poll/shifts/form_component.rb
+++ b/app/components/admin/poll/shifts/form_component.rb
@@ -17,16 +17,16 @@ class Admin::Poll::Shifts::FormComponent < ApplicationComponent
booth.polls.current_or_recounting
end
- def shift_vote_collection_dates(polls)
- return [] if polls.blank?
+ def shift_vote_collection_dates
+ return [] if voting_polls.blank?
- date_options((start_date(polls)..end_date(polls)), Poll::Shift.tasks[:vote_collection])
+ date_options((voting_start_date..voting_end_date), Poll::Shift.tasks[:vote_collection])
end
- def shift_recount_scrutiny_dates(polls)
- return [] if polls.blank?
+ def shift_recount_scrutiny_dates
+ return [] if recount_polls.blank?
- dates = polls.map(&:ends_at).map(&:to_date).sort.reduce([]) do |total, date|
+ dates = recount_polls.map(&:ends_at).map(&:to_date).sort.reduce([]) do |total, date|
initial_date = [date, Date.current].max
total << (initial_date..date + Poll::RECOUNT_DURATION).to_a
end
@@ -41,13 +41,13 @@ class Admin::Poll::Shifts::FormComponent < ApplicationComponent
dates.reject { |date| officer_shifts(task_id).include?(date) }
end
- def start_date(polls)
- start_date = polls.minimum(:starts_at).to_date
+ def voting_start_date
+ start_date = voting_polls.minimum(:starts_at).to_date
[start_date, Date.current].max
end
- def end_date(polls)
- polls.maximum(:ends_at).to_date
+ def voting_end_date
+ voting_polls.maximum(:ends_at).to_date
end
def officer_shifts(task_id)