brackt/server
Chris Parsons a054247a55
Fix standings snapshot upsert: atomic writes, correct date, and event-driven updates (#177)
- Add unique index on (team_id, season_id, snapshot_date) in team_standings_snapshots
  so concurrent writes can't produce duplicate rows (migration 0051)
- Rewrite createDailySnapshot to use INSERT ... ON CONFLICT DO UPDATE inside a
  transaction, replacing the SELECT-then-insert/skip pattern (N+1 queries, race-prone)
- Remove early-exit guard in server/snapshots.ts background job so it always
  upserts rather than skipping seasons that already have a snapshot for today
- Call createDailySnapshot in recalculateAffectedLeagues after recalculateStandings,
  so every bracket score update refreshes today's snapshot; wrapped in try/catch so
  a snapshot failure can't block Discord notifications
- Also call createDailySnapshot from the admin rescore and finalize-bracket actions
- Fix UTC date bug: replace toISOString().split('T')[0] with local date parts in
  both standings.ts and server/snapshots.ts (and the 7-day lookback query)
- Convert all dynamic await import() calls in bracket.server.ts to static imports

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 22:15:28 -07:00
..
__tests__ Claude/redesign autodraft queue c4 kp r (#40) 2026-02-27 22:16:26 -08:00
app.ts refactor: update import paths to use absolute paths for better clarity and maintainability 2025-10-24 21:20:19 -07:00
snapshots.ts Fix standings snapshot upsert: atomic writes, correct date, and event-driven updates (#177) 2026-03-18 22:15:28 -07:00
socket.d.ts feat: integrate Socket.IO server with HTTP server and draft room functionality 2025-10-16 18:15:04 -07:00
socket.ts feat: implement real-time queue updates via socket events in queue actions (#63) 2026-03-04 21:39:54 -08:00
timer.ts fix: harden draft timer system with race-condition safety and DRY refactor (#34) 2026-02-23 23:23:24 -08:00
types.d.ts feat: integrate Socket.IO server with HTTP server and draft room functionality 2025-10-16 18:15:04 -07:00
virtual-modules.d.ts feat: integrate Socket.IO server with HTTP server and draft room functionality 2025-10-16 18:15:04 -07:00