From 08ed5e0d871d032458f41f0a8a2794ecbf0fc6cc Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Tue, 25 Apr 2023 12:00:42 +0200 Subject: [PATCH] fix(type_de_champ): should use dossier revision instead of type_de_champ revision --- app/models/champs/header_section_champ.rb | 2 +- app/models/type_de_champ.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/champs/header_section_champ.rb b/app/models/champs/header_section_champ.rb index 864179e6f..03efd51d8 100644 --- a/app/models/champs/header_section_champ.rb +++ b/app/models/champs/header_section_champ.rb @@ -23,7 +23,7 @@ class Champs::HeaderSectionChamp < Champ def level if parent.present? - header_section_level_value.to_i + parent.current_section_level + header_section_level_value.to_i + parent.current_section_level(dossier.revision) elsif header_section_level_value header_section_level_value.to_i else diff --git a/app/models/type_de_champ.rb b/app/models/type_de_champ.rb index 1a1c9306e..a64e8bdd6 100644 --- a/app/models/type_de_champ.rb +++ b/app/models/type_de_champ.rb @@ -439,7 +439,7 @@ class TypeDeChamp < ApplicationRecord errs end - def current_section_level + def current_section_level(revision) tdcs = private? ? revision.types_de_champ_private.to_a : revision.types_de_champ_public.to_a previous_section_level(tdcs.take(tdcs.find_index(self)))