inline create_list_from_dossier into caller

This commit is contained in:
simon lehericey 2022-04-05 14:22:23 +02:00
parent 51b71aaa01
commit 97443e2ff6

View file

@ -1,18 +1,14 @@
class ActiveStorage::DownloadableFile
def self.create_list_from_dossier(dossier, for_expert = false)
dossier_export = PiecesJustificativesService.generate_dossier_export(dossier)
pjs = [dossier_export] + PiecesJustificativesService.liste_documents(dossier, for_expert)
pjs.map do |piece_justificative|
[
piece_justificative,
"dossier-#{dossier.id}/#{self.timestamped_filename(piece_justificative)}"
]
end
end
def self.create_list_from_dossiers(dossiers, for_expert = false)
dossiers.flat_map do |dossier|
create_list_from_dossier(dossier, for_expert)
dossier_export = PiecesJustificativesService.generate_dossier_export(dossier)
pjs = [dossier_export] + PiecesJustificativesService.liste_documents(dossier, for_expert)
pjs.map do |piece_justificative|
[
piece_justificative,
"dossier-#{dossier.id}/#{self.timestamped_filename(piece_justificative)}"
]
end
end
end