refactor(dossier_preloader): preload piece_justificative_template

This commit is contained in:
simon lehericey 2022-10-04 21:31:25 +02:00
parent 1f95f68fcc
commit 5920168077
2 changed files with 2 additions and 1 deletions

View file

@ -32,7 +32,7 @@ class DossierPreloader
def load_dossiers(dossiers)
all_champs = Champ
.includes(:type_de_champ, piece_justificative_file_attachment: :blob)
.includes(type_de_champ: { piece_justificative_template_attachment: :blob }, piece_justificative_file_attachment: :blob)
.where(dossier_id: dossiers)
.to_a

View file

@ -27,6 +27,7 @@ describe DossierPreloader do
expect(first_child.type).to eq('Champs::TextChamp')
expect(repetition.id).not_to eq(first_child.id)
expect(subject.champs.first.dossier).to eq(subject)
expect(subject.champs.first.type_de_champ.piece_justificative_template.attached?).to eq(false)
expect(first_child.parent).to eq(repetition)
end