pj_and_path only take dossier id
This commit is contained in:
parent
7ac1288905
commit
34b0578d70
3 changed files with 5 additions and 5 deletions
|
@ -1,16 +1,16 @@
|
|||
class ActiveStorage::DownloadableFile
|
||||
def self.create_list_from_dossiers(dossiers, for_expert = false)
|
||||
dossiers
|
||||
.map { |d| pj_and_path(d, PiecesJustificativesService.generate_dossier_export(d)) } +
|
||||
.map { |d| pj_and_path(d.id, PiecesJustificativesService.generate_dossier_export(d)) } +
|
||||
PiecesJustificativesService.liste_documents(dossiers, for_expert)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def self.pj_and_path(dossier, pj)
|
||||
def self.pj_and_path(dossier_id, pj)
|
||||
[
|
||||
pj,
|
||||
"dossier-#{dossier.id}/#{self.timestamped_filename(pj)}"
|
||||
"dossier-#{dossier_id}/#{self.timestamped_filename(pj)}"
|
||||
]
|
||||
end
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ class PiecesJustificativesService
|
|||
pjs_for_commentaires(dossier) +
|
||||
pjs_for_dossier(dossier, for_expert)
|
||||
|
||||
pjs.map { |piece_justificative| ActiveStorage::DownloadableFile.pj_and_path(dossier, piece_justificative) }
|
||||
pjs.map { |piece_justificative| ActiveStorage::DownloadableFile.pj_and_path(dossier.id, piece_justificative) }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ describe ProcedureArchiveService do
|
|||
)
|
||||
end
|
||||
|
||||
let(:documents) { [pj, bad_pj].map { |p| ActiveStorage::DownloadableFile.pj_and_path(dossier, p) } }
|
||||
let(:documents) { [pj, bad_pj].map { |p| ActiveStorage::DownloadableFile.pj_and_path(dossier.id, p) } }
|
||||
before do
|
||||
allow(PiecesJustificativesService).to receive(:liste_documents).and_return(documents)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue