perf(procedure edition): validate only once to avoid reload tdc with n+1

This commit is contained in:
simon lehericey 2022-09-30 14:26:35 +02:00 committed by LeSim
parent 298f223d02
commit adbb655a4a
3 changed files with 2 additions and 2 deletions

View file

@ -1,7 +1,6 @@
class Procedure::Card::AnnotationsComponent < ApplicationComponent
def initialize(procedure:)
@procedure = procedure
@procedure.validate(:publication)
@count = @procedure.draft_revision.types_de_champ.private_only.size
end

View file

@ -1,7 +1,6 @@
class Procedure::Card::ChampsComponent < ApplicationComponent
def initialize(procedure:)
@procedure = procedure
@procedure.validate(:publication)
@count = @procedure.draft_revision.types_de_champ.public_only.size
end

View file

@ -98,6 +98,8 @@ module Administrateurs
)
.find(params[:id])
@procedure.validate(:publication)
@current_administrateur = current_administrateur
@procedure_lien = commencer_url(path: @procedure.path)
@procedure_lien_test = commencer_test_url(path: @procedure.path)