From 5e24c0e19a9dcf643ae0b16aeea3c40bcb5aed78 Mon Sep 17 00:00:00 2001 From: Martin Date: Mon, 6 Mar 2023 16:27:33 +0100 Subject: [PATCH] =?UTF-8?q?correctif(dossier.export.pdf):=20l'export=20au?= =?UTF-8?q?=20format=20pdf=20d'un=20dossier=20ayant=20un=20champ=20de=20ty?= =?UTF-8?q?pe=20repetition=20contenant=20un=20titre=20est=20bien=20sous-se?= =?UTF-8?q?ctionn=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/concerns/dossier_sections_concern.rb | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/models/concerns/dossier_sections_concern.rb b/app/models/concerns/dossier_sections_concern.rb index bd8166efe..57ddf0ccf 100644 --- a/app/models/concerns/dossier_sections_concern.rb +++ b/app/models/concerns/dossier_sections_concern.rb @@ -22,14 +22,19 @@ module DossierSectionsConcern def index_for_section_header(champ) champs = champ.private? ? champs_private : champs_public - index = 1 champs.each do |c| - return index if c.stable_id == champ.stable_id - next unless c.visible? + if c.repetition? + index_in_repetition = c.rows.flatten.filter { _1.stable_id == champ.stable_id }.find_index(champ) + return "#{index}.#{index_in_repetition + 1}" if index_in_repetition + else + return index if c.stable_id == champ.stable_id + next unless c.visible? - index += 1 if c.type_de_champ.header_section? + index += 1 if c.type_de_champ.header_section? + end end + index end end end