brackt/app/routes/admin.sports-seasons.$id.events.$eventId.helpers.ts

23 lines
825 B
TypeScript
Raw Normal View History

feat: batch qualifying results entry (#290) Fixes #289 * docs: add batch qualifying results entry design spec Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * docs: add batch qualifying results entry implementation plan Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore: ignore .worktrees directory * feat: add qualifying results text parser with tests * fix: handle no-space after dot separator, tighten T-prefix to uppercase only * feat: add batch-add-results server intent with duplicate filtering Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat: add create-participant intent for inline participant creation * fix: trim sportsSeasonId validation in create-participant intent * feat: fill 0-QP rows for unplaced participants on qualifying event finalize Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * perf: use bulk insert for 0-QP rows on qualifying event finalize * feat: add BatchResultEntry component for paste-and-parse batch result import Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: disable add participant button while create request is in flight * feat: render BatchResultEntry on qualifying event pages Add BatchResultEntry component import and render it on event pages when the event is a qualifying event, not a final_standings/playoff_game type, and not yet complete. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: address final review issues (sportsSeasonId authority, participant validation, CRLF, unused prop) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-12 17:52:22 -04:00
/**
* Return participantIds from allParticipantIds that have no entry
* in existingResultParticipantIds. Used to find participants who
* need a 0-QP row after a qualifying event is finalized.
*/
export function findParticipantsWithoutResults(
allParticipantIds: string[],
existingResultParticipantIds: Set<string>
): string[] {
return allParticipantIds.filter((id) => !existingResultParticipantIds.has(id));
}
/**
* Filter incoming batch results to only those whose participantId
* is not already in the set of existing result participantIds.
*/
export function filterNewResults(
incoming: { participantId: string; placement: number }[],
existingParticipantIds: Set<string>
): { participantId: string; placement: number }[] {
return incoming.filter((r) => !existingParticipantIds.has(r.participantId));
}