refactor(dossier): use each instead of filter with side effects

This commit is contained in:
Paul Chavard 2024-07-16 09:03:56 +02:00
parent 7630cc39fa
commit 42ed6d7c87
No known key found for this signature in database

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