Merge pull request #9956 from mfo/US/amelioration-rebase

tech(perf.rebase): améliore la performance pour réconcilier les dossiers d'une procédure lorsqu'un administrateur change le formulaire (donc nouveau milésime 🍷)
This commit is contained in:
mfo 2024-01-31 17:26:25 +00:00 committed by GitHub
commit 86fb28bda0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2,6 +2,7 @@ module DossierRebaseConcern
extend ActiveSupport::Concern
def rebase!(force: false)
ProcedureRevisionPreloader.new([procedure.published_revision, revision].compact).all
return if procedure.published_revision.blank?
if force || can_rebase?
@ -57,7 +58,7 @@ module DossierRebaseConcern
.tap { _1.default = [] }
champs_by_stable_id = champs
.joins(:type_de_champ)
.includes(:type_de_champ)
.group_by(&:stable_id)
.transform_values { Champ.where(id: _1) }
.tap { _1.default = Champ.none }