Apply Style/CollectionMethods rubocop rule

We were already using `map` and `reduce` almost everywhere.
This commit is contained in:
Javi Martín
2019-10-26 00:44:19 +02:00
parent e3bfcbcd25
commit eafb4018bf
27 changed files with 57 additions and 56 deletions

View File

@@ -8,7 +8,7 @@ module ShiftsHelper
def shift_recount_scrutiny_dates(booth, polls)
return [] if polls.blank?
dates = polls.map(&:ends_at).map(&:to_date).sort.inject([]) do |total, date|
dates = polls.map(&:ends_at).map(&:to_date).sort.reduce([]) do |total, date|
initial_date = date < Date.current ? Date.current : date
total << (initial_date..date + Poll::RECOUNT_DURATION).to_a
end
@@ -33,7 +33,7 @@ module ShiftsHelper
end
def officer_select_options(officers)
officers.collect { |officer| [officer.name, officer.id] }
officers.map { |officer| [officer.name, officer.id] }
end
private