From 0a069c032487d953b5bf33b3302d2018b61f6ff7 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Thu, 4 Dec 2025 03:05:53 -0800 Subject: [PATCH] fix N+1 query in by_event: include user for membership --- app/controllers/api/v1/crew_gw_participations_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api/v1/crew_gw_participations_controller.rb b/app/controllers/api/v1/crew_gw_participations_controller.rb index edf0b3b..f6f2a3f 100644 --- a/app/controllers/api/v1/crew_gw_participations_controller.rb +++ b/app/controllers/api/v1/crew_gw_participations_controller.rb @@ -34,7 +34,7 @@ module Api return render json: { gw_event: nil, crew_gw_participation: nil, members_during_event: [] } unless event participation = @crew.crew_gw_participations - .includes(:gw_event, gw_individual_scores: [:crew_membership, :phantom_player]) + .includes(:gw_event, gw_individual_scores: [{ crew_membership: :user }, :phantom_player]) .find_by(gw_event: event) # Get all members who were active during the event (includes retired members who left after event started)