brackt/app/services/__tests__
Chris Parsons 7236c8aefb
Add Discord usernames, fix calculateTeamScore partial-score bug, and add admin re-score action (#160)
**Discord webhook improvements**
- Show team owner username in parentheses in standings (e.g. "1. Alpha FC (christhrowsrocks) — 150 pts")
- Show username in parentheses in match results for drafted participants
  (e.g. "Sporting (christhrowsrocks) def. Bodø/Glimt (apatel)"), omitting
  the parenthesis for the undrafted side
- Username lookup only runs after the webhook URL guard to avoid wasted DB queries
- 4 new tests covering all username display combinations

**Fix calculateTeamScore partial-score counting bug**
- isPartialScore participants were incorrectly counted in participantsCompleted
  and placementCounts, causing standings to show wrong remaining count and
  phantom placement badges (e.g. "5th×1") for still-alive bracket participants
- Floor points still flow into totalPoints (guaranteed value for ranking)
- 3 new unit tests covering partial vs finalized behavior in calculateTeamScore

**Admin Force Re-score action**
- New "Fantasy Standings" card on every sports season admin page with a
  Force Re-score button that triggers recalculateStandings on all linked
  fantasy seasons — useful after data corrections without waiting for a
  new scoring event
- Auth guard added to the action (was missing — layout loader only protects GET)
- Returns a meaningful message when no linked seasons exist
- Intent discriminant on action returns so success banners use actionData.intent
  instead of fragile message.includes() checks

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-17 14:34:09 -07:00
..
bracket-simulator.test.ts feat: implement Expected Value System with ICM probability calculator 2025-11-17 22:19:46 -08:00
discord.test.ts Add Discord usernames, fix calculateTeamScore partial-score bug, and add admin re-score action (#160) 2026-03-17 14:34:09 -07:00
ev-calculator.test.ts fix: align ev-calculator tests with decimal (0-1) probability format 2026-02-14 23:26:32 -08:00
icm-calculator.test.ts fix: correct test expectations for ICM edge cases and duplicate text queries 2026-02-17 14:24:07 -08:00
probability-engine.test.ts feat: implement Expected Value System with ICM probability calculator 2025-11-17 22:19:46 -08:00
probability-updater.test.ts feat: progressive floor scoring for playoff brackets (#100) 2026-03-10 10:27:58 -07:00