Merge pull request #6063 from tchak/fix-preview

Prevent crash in preview where there is no siblings
This commit is contained in:
LeSim 2021-04-07 09:56:41 +02:00 committed by GitHub
commit 8c5c360c4d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -88,7 +88,7 @@ class Champ < ApplicationRecord
end
def sections
siblings.filter(&:header_section?)
siblings&.filter(&:header_section?)
end
def mandatory_and_blank?

View file

@ -23,7 +23,7 @@ class Champs::HeaderSectionChamp < Champ
end
def libelle_with_section_index
if sections.none?(&:libelle_with_section_index?)
if sections&.none?(&:libelle_with_section_index?)
"#{section_index}. #{libelle}"
else
libelle