Fix Shift date ranges when poll is on recounting phase

This commit is contained in:
Bertocq
2017-10-23 20:17:42 +02:00
parent f9458b9ef0
commit 3adfbcb830
5 changed files with 10 additions and 4 deletions

View File

@@ -1,10 +1,12 @@
module ShiftsHelper
def shift_vote_collection_dates(booth, polls)
return [] if polls.blank?
date_options((start_date(polls)..end_date(polls)), Poll::Shift.tasks[:vote_collection], booth)
end
def shift_recount_scrutiny_dates(booth, polls)
return [] if polls.blank?
dates = polls.map(&:ends_at).map(&:to_date).sort.inject([]) do |total, date|
initial_date = date < Date.current ? Date.current : date
total << (initial_date..date + Poll::RECOUNT_DURATION).to_a