Unify majors: score once, fan out across windows + tennis bracket EV #106
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "feat/unify-majors-fanout"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Make a "major" (golf / tennis / CS2) scored once on its canonical tournament and fan out across every linked
sports_seasonwindow and league — for results entry (golf), brackets (tennis), and group/Swiss stages + bracket (CS2). Also makes in-progress EV simulation condition on the real bracket for both CS2 and (new) tennis.Highlights
Fan-out & completion (
app/services/sync-tournament-results.ts)syncTournamentResultsmarks each synced window complete (gated bymarkComplete), recalculates affected leagues, and counts recalc failures so a stale league can't hide behind a "completed" badge.syncMajorFromPrimaryEventpromotes a primary window's derived results to canonicaltournament_results(deleting rows for dropped placements) and fans out to siblings;fanOutMajorIfPrimarywires it into the bracket/CS2 scoring actions.Primary-event model (
scoring_events.is_primary, migration0122)getPrimaryEventForTournament/isReadOnlySibling/ensurePrimaryEvent/setPrimaryEvent.Tennis Grand Slam bracket (
tennis_128template +TEMPLATE_ROUND_CONFIG)resolveStructureSource/buildSpTranslator.Backfill (
scripts/backfill-major-linking.ts)--dryfirst.Testing
npm run typecheckclean; full unit suite 2681/2681 pass (the one failing suite is the pre-existingTeamAvatarStorybook a11y story).syncMajorFromPrimaryEvent,ensurePrimaryEvent/setPrimaryEvent, tennisdrawFromBracket+ bracket-honoring + exclusions +tennis_128scoring.Notes
0122_soft_longshot.sql) addingscoring_events.is_primary— runnpm run db:migrate.npx tsx scripts/backfill-major-linking.ts) to reconcile existing data.🤖 Generated with Claude Code