From 383315d0c3a5b237e2d04b35895c864e150b4649 Mon Sep 17 00:00:00 2001 From: Chris Parsons <438676+chrisparsons83@users.noreply.github.com> Date: Wed, 1 Apr 2026 00:40:55 -0700 Subject: [PATCH] Auto-eliminate non-group participants on group generation (#250) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When generating groups for a tournament (e.g. FIFA World Cup), any participants in the sport season who were not assigned to a group are now automatically marked as eliminated (finalPosition = 0) — the same result as running "Reprocess Eliminations" manually. Co-authored-by: Claude Sonnet 4.6 --- ...s-seasons.$id.events.$eventId.bracket.server.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/app/routes/admin.sports-seasons.$id.events.$eventId.bracket.server.ts b/app/routes/admin.sports-seasons.$id.events.$eventId.bracket.server.ts index 9ff856f..88d3ccd 100644 --- a/app/routes/admin.sports-seasons.$id.events.$eventId.bracket.server.ts +++ b/app/routes/admin.sports-seasons.$id.events.$eventId.bracket.server.ts @@ -824,7 +824,19 @@ export async function action({ request, params }: Route.ActionArgs) { // Generate the empty knockout bracket structure await generateBracketFromTemplate(params.eventId, templateId); - return { success: "Groups and knockout bracket structure created successfully" }; + // Eliminate participants from this sport season who are not in any group + const allParticipants = await findParticipantsBySportsSeasonId(params.id); + let eliminatedCount = 0; + for (const participant of allParticipants) { + if (!uniqueParticipants.has(participant.id)) { + await setParticipantResult(participant.id, params.id, 0); + eliminatedCount++; + } + } + + return { + success: `Groups and knockout bracket structure created successfully${eliminatedCount > 0 ? ` (${eliminatedCount} participant(s) not in any group marked as eliminated)` : ""}`, + }; } catch (error) { logger.error("Error generating groups:", error); return {