brackt/app/routes/leagues
Chris Parsons dbffddc9ff
Partial bracket scoring, code review fixes, and double-chance logic (#156)
## Partial bracket scoring
- `processMatchResult`: new exported function that scores a single match
  immediately (loser → final placement, winner → provisional floor).
  Called from `set-winner` and `set-round-winners` so points are awarded
  as soon as a winner is set, before the full round is complete.
- `set-winner`: passes `eventName` to `processMatchResult`.
- `set-round-winners`: batches side effects — calls `recalculateAffectedLeagues`
  and `updateProbabilitiesAfterResult` once after the loop instead of per-match
  (`skipSideEffects: true` per match).

## Code review fixes
- **ROUND_CONFIG** (S1): extracted a `RoundScoringConfig` lookup table +
  `getRoundConfig()` helper, eliminating three parallel `if/else` chains in
  `processPlayoffEvent`, `processMatchResult`, and `getGuaranteedMinimumPosition`.
  AFL template overrides live in `TEMPLATE_ROUND_CONFIG` with an explanatory
  comment about why the `bracketTemplateId` guard is required.
- **skipSideEffects** (C2): new param on `processMatchResult`; bracket server
  uses it to batch standings/probability recalc in `set-round-winners`.
- **eventName** (W1): passed through `processMatchResult` → `recalculateAffectedLeagues`.
- **Round validation** (W2): `set-round-winners` now guards `match.round === round`
  before processing each assignment.
- **Comments** (C3/S3/W3): added notes on non-scoring loser assumption,
  `isScoring ?? true` default, and AFL Semi-Finals template requirement.

## PlayoffBracket eliminated-teams fix + tests
- Fixed `computeEliminatedByRound` to track participant *appearances* (not just
  wins), so AFL QF losers who advance to Semi-Finals via double-chance are
  correctly excluded from the QF eliminated list.
- Extracted the logic as an exported pure function for testability.
- Added 4 tests: standard elimination, AFL QF loser → SF win, AFL QF loser →
  SF loss, and normal advancement not protecting a later loser.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-17 10:50:30 -07:00
..
__tests__ Partial bracket scoring, code review fixes, and double-chance logic (#156) 2026-03-17 10:50:30 -07:00
$leagueId.draft-board.$seasonId.tsx feat: add meta title to all route pages (#109) 2026-03-10 12:10:52 -07:00
$leagueId.draft.$seasonId.tsx feat: add meta title to all route pages (#109) 2026-03-10 12:10:52 -07:00
$leagueId.server.ts Add event_starts_at timestamp to scoring events for sub-day ordering (#146) 2026-03-15 10:22:42 -07:00
$leagueId.settings.tsx feat: add meta title to all route pages (#109) 2026-03-10 12:10:52 -07:00
$leagueId.sports-seasons.$sportsSeasonId.server.ts Fix First Four appearing out of order in NCAA bracket display (#152) 2026-03-16 12:27:43 -07:00
$leagueId.sports-seasons.$sportsSeasonId.tsx feat: add meta title to all route pages (#109) 2026-03-10 12:10:52 -07:00
$leagueId.standings.$seasonId.teams.$teamId.tsx Simplify team breakdown page layout and fix code quality issues (#155) 2026-03-17 09:20:41 -07:00
$leagueId.standings.$seasonId.tsx feat: add meta title to all route pages (#109) 2026-03-10 12:10:52 -07:00
$leagueId.tsx Display upcoming matches (#141) 2026-03-12 10:12:38 -07:00
new.tsx feat: add meta title to all route pages (#109) 2026-03-10 12:10:52 -07:00