- Auto-heal now only promotes a new primary when the deleted event was
itself the primary window. Golf-style shared majors intentionally have
no primary (scored on the canonical tournament page), so deleting one
of their windows no longer flips a sibling into a primary and changes
its scoring/guard behavior. Adds a regression test for that case.
- Replace the relation-heavy getSportsSeasonsByTournament + double
Array.find in the events loader with a new countWindowsByTournament
helper (count(distinct sports_season_id)) and a single cached lookup.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CBzjCLVkVaQMj1MF3K54t2
Deleting an event from a season only affects that season's scoring
event; the shared canonical tournament and the other linked seasons
survive. The old flow never communicated this and offered no way to
manage the relationship, so it felt like deleting an event might wipe
the whole shared tournament.
- deleteScoringEvent is now shared-tournament-aware: it auto-heals the
primary window (promotes the earliest remaining window when the
primary is removed) and optionally deletes the canonical tournament
when the last linked window is removed. Returns a result describing
what happened.
- Add deleteTournament model helper.
- Events page: delete confirmation now explains exactly what a delete
does (removed from this season only vs. last window), with an opt-in
checkbox to also remove the orphaned shared tournament.
- Tournament page: add a per-window "Remove" control on the Linked
Sports Seasons card to unlink a season, reusing the auto-heal path.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CBzjCLVkVaQMj1MF3K54t2