fix(perf): last n+1

This commit is contained in:
Martin 2024-01-31 16:48:39 +01:00
parent 47ff3086af
commit 437b3d2a61

View file

@ -58,7 +58,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 }