refactor(dossier_preloader): preload piece_justificative_template
This commit is contained in:
parent
1f95f68fcc
commit
5920168077
2 changed files with 2 additions and 1 deletions
|
@ -32,7 +32,7 @@ class DossierPreloader
|
||||||
|
|
||||||
def load_dossiers(dossiers)
|
def load_dossiers(dossiers)
|
||||||
all_champs = Champ
|
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)
|
.where(dossier_id: dossiers)
|
||||||
.to_a
|
.to_a
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ describe DossierPreloader do
|
||||||
expect(first_child.type).to eq('Champs::TextChamp')
|
expect(first_child.type).to eq('Champs::TextChamp')
|
||||||
expect(repetition.id).not_to eq(first_child.id)
|
expect(repetition.id).not_to eq(first_child.id)
|
||||||
expect(subject.champs.first.dossier).to eq(subject)
|
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)
|
expect(first_child.parent).to eq(repetition)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue