Refactor: use select block to select stuff

This commit is contained in:
Simon Lehericey 2017-05-17 11:18:01 +02:00
parent a412823257
commit a213032f28
2 changed files with 2 additions and 8 deletions

View file

@ -10,9 +10,6 @@ class Admin::PrevisualisationsController < AdminController
@champs = @dossier.ordered_champs
@headers = @champs.inject([]) do |acc, champ|
acc.push(champ) if champ.type_champ == 'header_section'
acc
end
@headers = @champs.select { |champ| champ.type_champ == 'header_section' }
end
end

View file

@ -25,10 +25,7 @@ class Backoffice::DossiersController < Backoffice::DossiersListController
unless @facade.nil?
@champs_private = @facade.champs_private
@headers_private = @champs_private.inject([]) do |acc, champ|
acc.push(champ) if champ.type_champ == 'header_section'
acc
end
@headers_private = @champs_private.select { |champ| champ.type_champ == 'header_section' }
end
Notification.where(dossier_id: params[:id].to_i).update_all already_read: true