Merge pull request #10613 from tchak/refactor-remove_piece_justificative_file_not_visible
refactor(dossier): use each instead of filter with side effects
This commit is contained in:
commit
f88fb3babc
1 changed files with 6 additions and 1 deletions
|
@ -936,7 +936,12 @@ class Dossier < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def remove_piece_justificative_file_not_visible!
|
def remove_piece_justificative_file_not_visible!
|
||||||
champs.filter { _1.piece_justificative_file.attached? && !_1.visible? && _1.piece_justificative_file.purge_later }
|
champs.each do |champ|
|
||||||
|
next unless champ.piece_justificative_file.attached?
|
||||||
|
next if champ.visible?
|
||||||
|
|
||||||
|
champ.piece_justificative_file.purge_later
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_mandatory_and_visible_champs
|
def check_mandatory_and_visible_champs
|
||||||
|
|
Loading…
Reference in a new issue