dossier: export PJs from private champs

Fix #5297
This commit is contained in:
Pierre de La Morinerie 2020-06-24 13:21:51 +00:00
parent 6f14e7783f
commit acc1cb1abd
2 changed files with 9 additions and 1 deletions

View file

@ -43,7 +43,7 @@ class PiecesJustificativesService
private
def self.pjs_for_champs(dossier)
allowed_champs = dossier.champs
allowed_champs = dossier.champs + dossier.champs_private
allowed_child_champs = allowed_champs
.filter { |c| c.type_champ == TypeDeChamp.type_champs.fetch(:repetition) }

View file

@ -16,6 +16,14 @@ describe ActiveStorage::DownloadableFile do
it { expect(list.length).to eq 1 }
end
context 'when there is a private piece_justificative' do
before do
dossier.champs_private << create(:champ, :piece_justificative, :with_piece_justificative_file, private: true)
end
it { expect(list.length).to eq 1 }
end
context 'when there is a repetition bloc' do
let(:champ) { build(:champ_repetition_with_piece_jointe) }
let(:dossier) { create(:dossier, :en_construction, champs: [champ]) }