perf(dossier): memoize champ.sections on dossier
This commit is contained in:
parent
51af70639b
commit
c60a8970f1
3 changed files with 36 additions and 19 deletions
|
@ -81,18 +81,8 @@ class Champ < ApplicationRecord
|
|||
!private?
|
||||
end
|
||||
|
||||
def siblings
|
||||
if parent
|
||||
parent&.champs
|
||||
elsif public?
|
||||
dossier&.champs
|
||||
else
|
||||
dossier&.champs_private
|
||||
end
|
||||
end
|
||||
|
||||
def sections
|
||||
siblings&.filter(&:header_section?)
|
||||
@sections ||= dossier.sections_for(self)
|
||||
end
|
||||
|
||||
def mandatory_and_blank?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue