brackt/app/test/fixtures/season.ts
Chris Parsons d468385d90
Add auto-start draft at scheduled time (#437) (#438)
Commissioners can now opt in to having a draft start automatically at
its scheduled draftDateTime rather than requiring a manual "Start Draft"
click. The 1-second timer loop checks for eligible seasons each tick and
calls the new shared startDraft() service, which is also used by the
existing commissioner HTTP route.

- Add autoStartDraft boolean to seasons table (migration 0108)
- Extract core start logic into app/services/draft-autostart.ts so both
  the API route and the timer can call it without AsyncLocalStorage
- Add checkAndAutoStartDrafts() to the timer tick; disables autoStartDraft
  and stops retrying if no draft order is set at fire time
- Guard against null draftDateTime in both the timer query (isNotNull)
  and server actions (autoStartDraft forced false when datetime is null)
- Add "Auto-start at scheduled time" checkbox to league creation wizard
  (step 3) and league settings, gated on date+time being set
- Show countdown + "Start Now" button in draft room when auto-start is
  scheduled; reuses the existing nowForPauseCheck 1-second ticker
- Show orange warning banner on league homepage to commissioners when
  auto-start is within 1 hour and no draft order has been configured

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 23:37:29 -07:00

42 lines
958 B
TypeScript

export const mockSeason = {
id: 'season-1',
leagueId: 'league-1',
year: 2025,
status: 'pre_draft' as const,
templateId: null,
draftRounds: 20,
flexSpots: 0,
draftDateTime: new Date('2025-12-01T19:00:00'),
autoStartDraft: false,
draftInitialTime: 120,
draftIncrementTime: 15,
currentPickNumber: 1,
draftStartedAt: null,
draftPaused: false,
inviteCode: 'TEST123',
pointsFor1st: 100,
pointsFor2nd: 70,
pointsFor3rd: 50,
pointsFor4th: 40,
pointsFor5th: 25,
pointsFor6th: 25,
pointsFor7th: 15,
pointsFor8th: 15,
createdAt: new Date('2025-01-01'),
updatedAt: new Date('2025-01-01'),
};
export const mockActiveSeason = {
...mockSeason,
id: 'season-2',
status: 'active' as const,
draftStartedAt: new Date('2025-12-01T19:00:00'),
};
export const mockDraftSeason = {
...mockSeason,
id: 'season-3',
status: 'draft' as const,
draftStartedAt: new Date('2025-12-01T19:00:00'),
currentPickNumber: 5,
};