brackt/app/services
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
..
__tests__ Add Discord usernames, fix calculateTeamScore partial-score bug, and add admin re-score action (#160) 2026-03-17 14:34:09 -07:00
simulations Add NBA playoff bracket Monte Carlo simulator (#154) 2026-03-16 21:43:39 -07:00
bracket-simulator.ts feat: implement Expected Value System with ICM probability calculator 2025-11-17 22:19:46 -08:00
discord.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.ts User/chris/ev f1 framework (#93) 2026-03-09 15:34:31 -07:00
icm-calculator.ts feat: implement sports season expected value calculations and probability updates 2025-11-21 22:05:50 -08:00
probability-engine.ts feat: implement Expected Value System with ICM probability calculator 2025-11-17 22:19:46 -08:00
probability-updater.ts feat: implement sports season expected value calculations and probability updates 2025-11-21 22:05:50 -08:00