brackt/app/models
Chris Parsons 01f1480159
Claude/fix pick timer ghll n (#29)
* Fix force-manual-pick resetting next team's timer to initial time

When a commissioner forced a manual pick, the next team's timer was
being reset to the initial time (2 minutes) instead of carrying
forward their existing time bank balance.

This aligns force-manual-pick with the behavior of regular user picks
and force-autopick: the picking team gets their increment added, and
the next team's timer is left untouched so their bank carries forward.

https://claude.ai/code/session_01X7gwWmafUSEvVHcV7Raz5p

* Add regression tests for draft.force-manual-pick timer behavior

18 tests across 5 describe blocks covering:
- Authorization (401/403)
- Input validation (missing fields, bad participant, ineligible sport)
- Successful pick (response shape, draft-complete detection, socket events)
- Timer behavior (increment added to picking team, new timer creation, additive not reset)
- Two regression tests confirming the next team's timer is never touched:
  draftTimers.findFirst called exactly once, no timer-update emitted for
  next team, db.update called exactly twice (not three times)

https://claude.ai/code/session_01X7gwWmafUSEvVHcV7Raz5p

* Add TypeScript types and improve draft validation (#28)

* Code review fixes: type safety, security hardening, and dead code removal

- Fix Socket.IO event types: draft-paused and draft-resumed were typed as
  () => void but are emitted with { seasonId, paused } data payloads

- Fix draft.force-manual-pick: add missing season.status === "draft" guard
  so commissioners cannot force picks outside an active draft; add duplicate
  pick-number check so a slot cannot be assigned two picks (the previous
  code only checked participant uniqueness, not slot uniqueness)

- Replace args: any with ActionFunctionArgs / Route.LoaderArgs across all
  API routes and league loaders; replace (auth as any).userId casts with
  proper const { userId } = await getAuth(args) destructuring

- Remove unused isSnakeDraft = true dead variable from draft.make-pick

- Replace autodraftSettings: any and draftSlots: any[] in draft-utils with
  properly typed InferSelectModel / DraftSlot types

- Update force-manual-pick tests: sequence draftPicks.findFirst mock for
  the two-call flow; add new tests for status-check and slot-uniqueness

https://claude.ai/code/session_01FKq2gPFYpgdfxr8cw4Z2AZ

* Fix RouterContextProvider type errors in action test files

Cast context argument to RouterContextProvider in test helpers so
ActionFunctionArgs strict typing is satisfied without weakening the
production action signatures back to any.

https://claude.ai/code/session_01FKq2gPFYpgdfxr8cw4Z2AZ

---------

Co-authored-by: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-02-22 19:29:29 -08:00
..
__tests__ feat: implement Expected Value System with ICM probability calculator 2025-11-17 22:19:46 -08:00
commissioner.ts Add implementation plan for commissioner-without-team feature (#6) 2026-02-20 08:45:09 -08:00
draft-pick.ts fix: Pass database instance to isParticipantDrafted in timer context 2025-10-28 23:40:29 -07:00
draft-queue.ts feat: Refactor database connection handling in draft-related functions for improved flexibility 2025-10-26 20:35:55 -07:00
draft-slot.ts feat: add draft order management with UI for manual and random ordering 2025-10-15 08:58:35 -07:00
draft-timer.ts Fix draft timer creation for teams without existing timers (#26) 2026-02-22 17:27:16 -08:00
draft-utils.ts Claude/fix pick timer ghll n (#29) 2026-02-22 19:29:29 -08:00
event-result.ts feat: Add scoring event and results management with comprehensive scoring rules and standings tracking 2025-10-28 23:50:50 -07:00
index.ts feat: add draft pick, queue, and timer models with database schema updates 2025-10-16 00:32:48 -07:00
league.ts Include commissioner leagues in user's active leagues (#8) 2026-02-20 10:28:37 -08:00
participant-expected-value.ts Add Zod validation and expand export/import for EV and results data (#14) 2026-02-20 20:25:25 -08:00
participant-result.ts feat: Implement bracket expansion plan to support various tournament structures 2025-11-03 09:36:16 -08:00
participant-season-result.ts feat: Implement season standings processing and participant result management for final standings events 2025-11-08 22:35:07 -08:00
participant.ts Add Zod validation and expand export/import for EV and results data (#14) 2026-02-20 20:25:25 -08:00
playoff-match.ts feat: add FIFA World Cup 48-team bracket template with group stage and projected scoring 2026-02-14 22:30:12 -08:00
qualifying-points.ts feat: Implement Qualifying Points Standings component and related logic 2025-11-11 10:08:25 -08:00
scoring-calculator.ts feat: add FIFA World Cup 48-team bracket template with group stage and projected scoring 2026-02-14 22:30:12 -08:00
scoring-event.ts Refactor code structure for improved readability and maintainability 2025-11-03 13:16:37 -08:00
scoring-rules.ts feat: Add scoring rules editor to league settings and creation pages 2025-10-29 00:04:27 -07:00
season-sport.ts feat: Refactor database connection handling in draft-related functions for improved flexibility 2025-10-26 20:35:55 -07:00
season-template-sport.ts refactor: remove isRequired field from season sports and templates 2025-10-13 15:00:59 -07:00
season-template.ts feat: add sports and participant models with admin user functionality 2025-10-12 21:16:00 -07:00
season.ts feat: add recharts library and implement PointProgressionChart component for historical views 2025-11-14 21:18:34 -08:00
sport.ts feat: add icon support for sports with file upload and active seasons display 2025-10-13 10:30:47 -07:00
sports-season.ts feat: add bulk participant creation and expected value field 2025-10-15 21:21:33 -07:00
standings.ts feat: add FIFA World Cup 48-team bracket template with group stage and projected scoring 2026-02-14 22:30:12 -08:00
team.ts feat: add fantasy league schema and new league routes 2025-10-11 00:07:39 -07:00
tournament-group.ts feat: add FIFA World Cup 48-team bracket template with group stage and projected scoring 2026-02-14 22:30:12 -08:00
user.ts feat: add team ownership management UI with admin controls 2025-10-21 22:15:15 -07:00