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:
Paul Chavard 2024-07-16 13:06:55 +00:00 committed by GitHub
commit f88fb3babc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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