Add Style/CollectionMethods to rubocop

This commit is contained in:
Paul Chavard 2019-09-12 11:26:22 +02:00
parent 3f970eee74
commit 3b8d3b7967
37 changed files with 67 additions and 60 deletions

View file

@ -36,7 +36,7 @@ module CreateAvisConcern
if failed.any?
flash.now.alert = failed
.select { |avis| avis.errors.present? }
.filter { |avis| avis.errors.present? }
.map { |avis| "#{avis.email} : #{avis.errors.full_messages.join(', ')}" }
# When an error occurs, return the avis back to the controller

View file

@ -76,7 +76,7 @@ module Instructeurs
if @current_filters.count > 0
filtered_ids = procedure_presentation.filtered_ids(@dossiers, statut)
filtered_sorted_ids = sorted_ids.select { |id| filtered_ids.include?(id) }
filtered_sorted_ids = sorted_ids.filter { |id| filtered_ids.include?(id) }
else
filtered_sorted_ids = sorted_ids
end

View file

@ -24,11 +24,11 @@ class RootController < ApplicationController
.map.with_index { |type_de_champ, i| type_de_champ.champ.build(id: i) }
all_champs
.select { |champ| champ.type_champ == TypeDeChamp.type_champs.fetch(:header_section) }
.filter { |champ| champ.type_champ == TypeDeChamp.type_champs.fetch(:header_section) }
.each { |champ| champ.type_de_champ.libelle = 'un super titre de section' }
all_champs
.select { |champ| [TypeDeChamp.type_champs.fetch(:drop_down_list), TypeDeChamp.type_champs.fetch(:multiple_drop_down_list)].include?(champ.type_champ) }
.filter { |champ| [TypeDeChamp.type_champs.fetch(:drop_down_list), TypeDeChamp.type_champs.fetch(:multiple_drop_down_list)].include?(champ.type_champ) }
.each do |champ|
champ.type_de_champ.drop_down_list = DropDownList.new(type_de_champ: champ.type_de_champ)
champ.drop_down_list.value =
@ -47,7 +47,7 @@ class RootController < ApplicationController
type_champ_values.each do |(type_champ, value)|
all_champs
.select { |champ| champ.type_champ == type_champ }
.filter { |champ| champ.type_champ == type_champ }
.each { |champ| champ.value = value }
end

View file

@ -356,7 +356,7 @@ class StatsController < ApplicationController
if weekly_dossiers_count == 0
result = 0
else
weekly_dossier_with_avis_count = weekly_dossiers.select { |dossier| dossier.avis.present? }.count
weekly_dossier_with_avis_count = weekly_dossiers.filter { |dossier| dossier.avis.present? }.count
result = percentage(weekly_dossier_with_avis_count, weekly_dossiers_count)
end

View file

@ -6,7 +6,7 @@ module Users
.includes(:procedure)
.map(&:procedure)
.uniq
.select(&:publiee?)
.filter(&:publiee?)
@popular_demarches = Procedure
.includes(:service)