fix(expert_export): an expert export excludes annotation and avis
This commit is contained in:
parent
c62d83a7f5
commit
84d08d4d24
3 changed files with 11 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
||||||
class ActiveStorage::DownloadableFile
|
class ActiveStorage::DownloadableFile
|
||||||
def self.create_list_from_dossiers(dossiers, for_expert = false)
|
def self.create_list_from_dossiers(dossiers, for_expert = false)
|
||||||
PiecesJustificativesService.generate_dossier_export(dossiers) +
|
PiecesJustificativesService.generate_dossier_export(dossiers, include_infos_administration: !for_expert) +
|
||||||
PiecesJustificativesService.liste_documents(dossiers, for_expert)
|
PiecesJustificativesService.liste_documents(dossiers, for_expert)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ class PiecesJustificativesService
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.generate_dossier_export(dossiers)
|
def self.generate_dossier_export(dossiers, include_infos_administration: false)
|
||||||
return [] if dossiers.empty?
|
return [] if dossiers.empty?
|
||||||
|
|
||||||
pdfs = []
|
pdfs = []
|
||||||
|
@ -97,7 +97,7 @@ class PiecesJustificativesService
|
||||||
pdf = ApplicationController
|
pdf = ApplicationController
|
||||||
.render(template: 'dossiers/show', formats: [:pdf],
|
.render(template: 'dossiers/show', formats: [:pdf],
|
||||||
assigns: {
|
assigns: {
|
||||||
include_infos_administration: true,
|
include_infos_administration:,
|
||||||
dossier: dossier
|
dossier: dossier
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -96,8 +96,15 @@ describe Experts::AvisController, type: :controller do
|
||||||
|
|
||||||
subject { get :telecharger_pjs, params: { id: avis.id, procedure_id: } }
|
subject { get :telecharger_pjs, params: { id: avis.id, procedure_id: } }
|
||||||
|
|
||||||
|
before do
|
||||||
|
allow(PiecesJustificativesService).to receive(:generate_dossier_export).and_return([]).with([dossier], include_infos_administration: false)
|
||||||
|
end
|
||||||
|
|
||||||
context 'with a valid avis' do
|
context 'with a valid avis' do
|
||||||
it { is_expected.to have_http_status(:success) }
|
it do
|
||||||
|
is_expected.to have_http_status(:success)
|
||||||
|
expect(PiecesJustificativesService).to have_received(:generate_dossier_export)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with a revoked avis' do
|
context 'with a revoked avis' do
|
||||||
|
|
Loading…
Reference in a new issue