brackt/app/models/__tests__
Chris Parsons fa0e798db7
Add "Games to Score" widget to admin dashboard (#183)
* Add "Games to Score" widget to admin dashboard

Shows scoring events for today and tomorrow in a tabbed card, with
status badges (Pending/Scored), a scored/total progress counter, and
direct "Score" / "View" links to each event's results page. Excludes
non-scoring schedule_event types so only actionable events surface.

- app/models/scoring-event.ts: add getEventsForDates() model function
  that queries scoringEvents joined with sportsSeasons/sport for a
  given list of date strings
- app/routes/admin._index.tsx: call getEventsForDates([today, tomorrow])
  in the loader and render the GamesToScore component below the stats row
- app/models/__tests__/scoring-event-dashboard.test.ts: 8 unit tests
  covering empty input, shape mapping, multi-date filtering, completed
  events, and the inArray where conditions

https://claude.ai/code/session_014zKK15o5RJfTaodLvnZpF5

* Fix getEventsForDates to include bracket events by game scheduledAt

The previous implementation only matched on scoringEvents.eventDate,
which is often null for bracket events where individual game times are
set on playoffMatchGames.scheduledAt instead.

Switched to a two-step query mirroring getUpcomingEventsForDraftedParticipants:
1. selectDistinct event IDs via left joins through playoffMatches →
   playoffMatchGames, matching where eventDate IN dates OR any game's
   scheduledAt falls within the date range's timestamp bounds
2. findMany on the matched IDs with sportsSeason + sport relations

Updated tests to cover the two-step flow, leftJoin usage, and the
scheduledAt timestamp bounds appearing in the where clause.

https://claude.ai/code/session_014zKK15o5RJfTaodLvnZpF5

* Document dual game date storage in CLAUDE.md

scoringEvents.eventDate and playoffMatchGames.scheduledAt both hold game
dates depending on the event type. Added a dedicated section under
Important Patterns explaining when each is used and the two-step
selectDistinct + findMany pattern required for correct date queries.

https://claude.ai/code/session_014zKK15o5RJfTaodLvnZpF5

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-19 19:25:37 -07:00
..
afl-finals.test.ts feat: Implement AFL Finals bracket template and scoring logic with double-chance system 2025-11-12 23:21:22 -08:00
auto-pick.test.ts feat: proactively prune ineligible queue items after each pick (#59) 2026-03-02 22:07:22 -08:00
bracket-integration.test.ts Add bracket seeding tests and implement tournament-style seeding for 16 and 32-team brackets 2025-11-04 22:09:44 -08:00
bracket-seeding.test.ts Add bracket seeding tests and implement tournament-style seeding for 16 and 32-team brackets 2025-11-04 22:09:44 -08:00
bracket-templates.test.ts feat: Implement NFL 14 bracket template with bye week handling and comprehensive unit tests 2025-11-08 21:56:57 -08:00
commissioner.test.ts Grant sitewide admins commissioner-level access in leagues (#162) 2026-03-18 00:41:56 -07:00
ncaa-68-bracket.test.ts Add per-event configurable region config for NCAA-style brackets (#149) (#149) 2026-03-15 21:52:47 -07:00
nfl-bracket.test.ts feat: Implement NFL 14 bracket template with bye week handling and comprehensive unit tests 2025-11-08 21:56:57 -08:00
participant-expected-value.test.ts feat: implement Expected Value System with ICM probability calculator 2025-11-17 22:19:46 -08:00
playoff-match-game.test.ts Add playoff match game scheduling and odds management (#135) 2026-03-11 14:17:43 -07:00
playoff-match-odds.test.ts Add playoff match game scheduling and odds management (#135) 2026-03-11 14:17:43 -07:00
point-progression.test.ts feat: add recharts library and implement PointProgressionChart component for historical views 2025-11-14 21:18:34 -08:00
process-match-result.test.ts Fix partial bracket scoring, rank labels, and Discord notification bugs (#158) 2026-03-17 12:34:10 -07:00
progressive-floor-scoring.test.ts Fix partial bracket scoring, rank labels, and Discord notification bugs (#158) 2026-03-17 12:34:10 -07:00
qualifying-points.test.ts feat: Implement Qualifying Points Standings component and related logic 2025-11-11 10:08:25 -08:00
scoring-calculator-qualifying.test.ts feat: Implement Qualifying Points Standings component and related logic 2025-11-11 10:08:25 -08:00
scoring-calculator.test.ts feat: Implement bracket expansion plan to support various tournament structures 2025-11-03 09:36:16 -08:00
scoring-event-dashboard.test.ts Add "Games to Score" widget to admin dashboard (#183) 2026-03-19 19:25:37 -07:00
season-standings.test.ts feat: Implement season standings processing and participant result management for final standings events 2025-11-08 22:35:07 -08:00
sports-season.test.ts Add isDraftable toggle to sport seasons (#165) (#178) 2026-03-18 22:40:19 -07:00
standings-snapshots.test.ts feat: implement daily standings snapshot system with admin management interface 2025-11-14 09:15:58 -08:00
team-projected-score.test.ts Fix participantsRemaining not counting non-scoring-round eliminations (#161) 2026-03-17 15:02:19 -07:00
tiebreaker-logic.test.ts feat: add standings page and enhance standings functionality 2025-11-13 13:24:03 -08:00
upcoming-calendar.test.ts Add event_starts_at timestamp to scoring events for sub-day ordering (#146) 2026-03-15 10:22:42 -07:00