diff --git a/.rubocop.yml b/.rubocop.yml index 0db5b5e83..3781f9659 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -646,6 +646,9 @@ Style/MapToHash: Style/MethodDefParentheses: Enabled: true +Style/MinMaxComparison: + Enabled: true + Style/MutableConstant: Enabled: true diff --git a/app/helpers/shifts_helper.rb b/app/helpers/shifts_helper.rb index deb4d62b6..01552a730 100644 --- a/app/helpers/shifts_helper.rb +++ b/app/helpers/shifts_helper.rb @@ -9,7 +9,7 @@ module ShiftsHelper return [] if polls.blank? dates = polls.map(&:ends_at).map(&:to_date).sort.reduce([]) do |total, date| - initial_date = date < Date.current ? Date.current : date + initial_date = [date, Date.current].max total << (initial_date..date + Poll::RECOUNT_DURATION).to_a end date_options(dates.flatten.uniq, Poll::Shift.tasks[:recount_scrutiny], booth) @@ -25,7 +25,7 @@ module ShiftsHelper def start_date(polls) start_date = polls.map(&:starts_at).min.to_date - start_date < Date.current ? Date.current : start_date + [start_date, Date.current].max end def end_date(polls)