Merge pull request #326 from sgmap/use_filter
Refactor: use select block to select stuff
This commit is contained in:
commit
d00b5b5ac3
2 changed files with 2 additions and 8 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue