Skip to content

Commit

Permalink
Merge pull request #9098 from neinteractiveliterature/nbudin/issue9095
Browse files Browse the repository at this point in the history
Fix N+1 Query on signup admin page
  • Loading branch information
nbudin authored Jun 21, 2024
2 parents 4d4dcc1 + 947ffc7 commit 9ae245c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/graphql/types/signup_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 9ae245c

Please sign in to comment.