perf(rebase): includes champs.types de champs instead of n+1 on this one

This commit is contained in:
Martin 2024-01-31 16:20:50 +01:00
parent 3ea718a3f5
commit b964ac6a7a

View file

@ -57,7 +57,7 @@ module DossierRebaseConcern
.tap { _1.default = [] } .tap { _1.default = [] }
champs_by_stable_id = champs champs_by_stable_id = champs
.joins(:type_de_champ) .includes(:type_de_champ)
.group_by(&:stable_id) .group_by(&:stable_id)
.transform_values { Champ.where(id: _1) } .transform_values { Champ.where(id: _1) }
.tap { _1.default = Champ.none } .tap { _1.default = Champ.none }