From 947ffc731bb350ddbb713d8506903e46fd7319f0 Mon Sep 17 00:00:00 2001 From: Nat Budin Date: Fri, 21 Jun 2024 11:25:41 -0700 Subject: [PATCH] N+1 Query on signup admin page Fixes #9095 --- app/graphql/types/signup_type.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/graphql/types/signup_type.rb b/app/graphql/types/signup_type.rb index f48b96e8f0..a617cbf8ef 100644 --- a/app/graphql/types/signup_type.rb +++ b/app/graphql/types/signup_type.rb @@ -22,6 +22,8 @@ class Types::SignupType < Types::BaseObject field :created_at, Types::DateType, null: false, camelize: false field :updated_at, Types::DateType, null: false, camelize: false + association_loaders Signup, :run, :user_con_profile + # Why not just do this as an authorized hook? We need it to be safe to ask for this data even if # you can't actually read it def bucket_key @@ -46,6 +48,11 @@ def waitlist_position dataloader.with(Sources::WaitlistPosition).load(object) end + def age_restrictions_check + run.event # just to preload the association + object.age_restrictions_check + end + def counted !!object.counted end