fix(type_de_champ): should use dossier revision instead of type_de_champ revision

This commit is contained in:
Paul Chavard 2023-04-25 12:00:42 +02:00
parent eae58ae5b0
commit 08ed5e0d87
2 changed files with 2 additions and 2 deletions

View file

@ -23,7 +23,7 @@
class Champs::HeaderSectionChamp < Champ class Champs::HeaderSectionChamp < Champ
def level def level
if parent.present? 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 elsif header_section_level_value
header_section_level_value.to_i header_section_level_value.to_i
else else

View file

@ -439,7 +439,7 @@ class TypeDeChamp < ApplicationRecord
errs errs
end 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 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))) previous_section_level(tdcs.take(tdcs.find_index(self)))