fix(dossier.pdf): load all types_de_champ (including repetitions)

This commit is contained in:
Paul Chavard 2022-07-21 11:03:49 +02:00
parent 430365768a
commit 1fe82a956e
2 changed files with 3 additions and 3 deletions

View file

@ -117,7 +117,7 @@ class PiecesJustificativesService
.joins(:revisions) .joins(:revisions)
.where(revisions: { id: procedure.revisions }) .where(revisions: { id: procedure.revisions })
.to_a .to_a
.group_by(&:id) .index_by(&:id)
dossiers dossiers
.includes(:champs, :champs_private, :commentaires, :individual, .includes(:champs, :champs_private, :commentaires, :individual,

View file

@ -130,7 +130,7 @@ def add_identite_etablissement(pdf, etablissement)
end end
def add_single_champ(pdf, champ) def add_single_champ(pdf, champ)
tdc = @tdc_by_id[champ.type_de_champ_id].first tdc = @tdc_by_id[champ.type_de_champ_id]
case champ.type case champ.type
when 'Champs::PieceJustificativeChamp', 'Champs::TitreIdentiteChamp' when 'Champs::PieceJustificativeChamp', 'Champs::TitreIdentiteChamp'
@ -208,7 +208,7 @@ end
prawn_document(page_size: "A4") do |pdf| prawn_document(page_size: "A4") do |pdf|
@procedure ||= @dossier.procedure @procedure ||= @dossier.procedure
@tdc_by_id ||= @dossier.champs.map(&:type_de_champ).group_by(&:id) @tdc_by_id ||= @dossier.revision.types_de_champ.index_by(&:id)
pdf.font_families.update( 'marianne' => { pdf.font_families.update( 'marianne' => {
normal: Rails.root.join('lib/prawn/fonts/marianne/marianne-regular.ttf' ), normal: Rails.root.join('lib/prawn/fonts/marianne/marianne-regular.ttf' ),