From 63a0e33d783e20d444074c13a60331694261bdd2 Mon Sep 17 00:00:00 2001 From: mfo Date: Wed, 18 Dec 2024 16:54:09 +0100 Subject: [PATCH] fix(api.champs_loader): n+1 --- app/graphql/loaders/champ.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/graphql/loaders/champ.rb b/app/graphql/loaders/champ.rb index 61f270352ce..1ca431c8751 100644 --- a/app/graphql/loaders/champ.rb +++ b/app/graphql/loaders/champ.rb @@ -21,7 +21,8 @@ def perform(keys) private def query(keys) - ::Champ.where(@where).where(stable_id: keys) + # ::Champ.where(@where).where(stable_id: keys) + @where[:dossier].champs.filter { |c| c.stable_id.in?(keys) && c.private == @where[:private] } end end end