Merge pull request #8337 from mfo/US/instructeur#telecharger_pjs

correctif(instructeurs/dossier#telecharger_pjs): ne pas inclure les bills et horodatage quand on telecharge un dossier unitairement
This commit is contained in:
mfo 2022-12-27 09:07:48 +01:00 committed by GitHub
commit 72791bd5b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 5 deletions

View file

@ -230,7 +230,7 @@ module Instructeurs
end end
def telecharger_pjs def telecharger_pjs
files = ActiveStorage::DownloadableFile.create_list_from_dossiers(Dossier.where(id: dossier.id)) files = ActiveStorage::DownloadableFile.create_list_from_dossiers(Dossier.where(id: dossier.id), true)
cleaned_files = ActiveStorage::DownloadableFile.cleanup_list_from_dossier(files) cleaned_files = ActiveStorage::DownloadableFile.cleanup_list_from_dossier(files)
zipline(cleaned_files, "dossier-#{dossier.id}.zip") zipline(cleaned_files, "dossier-#{dossier.id}.zip")

View file

@ -224,11 +224,10 @@ describe 'Instructing a dossier:', js: true do
files = ZipTricks::FileReader.read_zip_structure(io: File.open(DownloadHelpers.download)) files = ZipTricks::FileReader.read_zip_structure(io: File.open(DownloadHelpers.download))
expect(DownloadHelpers.download).to include "dossier-#{dossier.id}.zip" expect(DownloadHelpers.download).to include "dossier-#{dossier.id}.zip"
expect(files.size).to be 3 expect(files.size).to be 2
expect(files[0].filename.include?('export')).to be_truthy expect(files[0].filename.include?('export')).to be_truthy
expect(files[1].filename.include?('piece_justificative_0')).to be_truthy expect(files[1].filename.include?('piece_justificative_0')).to be_truthy
expect(files[1].uncompressed_size).to be File.size(path) expect(files[1].uncompressed_size).to be File.size(path)
expect(files[2].filename.include?('horodatage/operation')).to be_truthy
end end
scenario 'A instructeur can download an archive containing several identical attachments' do scenario 'A instructeur can download an archive containing several identical attachments' do
@ -244,14 +243,13 @@ describe 'Instructing a dossier:', js: true do
files = ZipTricks::FileReader.read_zip_structure(io: File.open(DownloadHelpers.download)) files = ZipTricks::FileReader.read_zip_structure(io: File.open(DownloadHelpers.download))
expect(DownloadHelpers.download).to include "dossier-#{dossier.id}.zip" expect(DownloadHelpers.download).to include "dossier-#{dossier.id}.zip"
expect(files.size).to be 4 expect(files.size).to be 3
expect(files[0].filename.include?('export')).to be_truthy expect(files[0].filename.include?('export')).to be_truthy
expect(files[1].filename.include?('piece_justificative_0')).to be_truthy expect(files[1].filename.include?('piece_justificative_0')).to be_truthy
expect(files[2].filename.include?('piece_justificative_0')).to be_truthy expect(files[2].filename.include?('piece_justificative_0')).to be_truthy
expect(files[1].filename).not_to eq files[2].filename expect(files[1].filename).not_to eq files[2].filename
expect(files[1].uncompressed_size).to be File.size(path) expect(files[1].uncompressed_size).to be File.size(path)
expect(files[2].uncompressed_size).to be File.size(path) expect(files[2].uncompressed_size).to be File.size(path)
expect(files[3].filename.include?('horodatage/operation')).to be_truthy
end end
before { DownloadHelpers.clear_downloads } before { DownloadHelpers.clear_downloads }