Give the Hold'em dealer a session record: hand history, CSV export and standings #14

Merged
jheaps merged 3 commits from feature/casino-holdem-hand-history into master 2026-08-31 18:31:19 -06:00
Owner

Three related additions to the Texas Hold'em dealer tool, each building on the last:

Hand history — every resolved pot is logged (hand #, time, pot, who got paid what) and persisted with the rest of the table state, so a chip count disputed three hands later has something to point at.

CSV export — an Export CSV button downloads that log, since a paper trail that dies with the browser tab is not much of a paper trail. Disabled while the log is empty.

Session standings — each hand also records a per-seat ledger (what each player put in, what they took down), summed into a Session Standings panel: paid in, won, net, sorted by who is up. That is the number a dealer actually needs at cash-out, and it rides along in the same CSV so one file covers both the hand-by-hand trail and the settle-up.

Standings are keyed by seat id, not name, so renaming or reseating a player does not split their totals. Hands recorded before the ledger existed are skipped rather than counted wrong.

Validated end to end with Playwright against a local run: seated two players, played three hands with different winners, confirmed the pot math, the standings totals and colouring, the CSV contents (both sections), the empty states after clearing history, and that legacy history entries still render and export without errors. No console errors.

Three related additions to the Texas Hold'em dealer tool, each building on the last: **Hand history** — every resolved pot is logged (hand #, time, pot, who got paid what) and persisted with the rest of the table state, so a chip count disputed three hands later has something to point at. **CSV export** — an Export CSV button downloads that log, since a paper trail that dies with the browser tab is not much of a paper trail. Disabled while the log is empty. **Session standings** — each hand also records a per-seat ledger (what each player put in, what they took down), summed into a Session Standings panel: paid in, won, net, sorted by who is up. That is the number a dealer actually needs at cash-out, and it rides along in the same CSV so one file covers both the hand-by-hand trail and the settle-up. Standings are keyed by seat id, not name, so renaming or reseating a player does not split their totals. Hands recorded before the ledger existed are skipped rather than counted wrong. Validated end to end with Playwright against a local run: seated two players, played three hands with different winners, confirmed the pot math, the standings totals and colouring, the CSV contents (both sections), the empty states after clearing history, and that legacy history entries still render and export without errors. No console errors.
jheaps added 1 commit 2026-08-31 17:15:38 -06:00
Give the dealer a running record of resolved pots — hand number, total
pot, who got paid what, and the time — instead of losing that
information the moment the pot wizard closes. It's the kind of audit
trail a real dealer needs when a chip count gets disputed after the
fact.

- state.js tracks state.handNumber and state.handHistory (capped at 200
  entries) and persists both through the existing localStorage save/load
  path, with backfill defaults for tables saved before this change.
- potWizard.js now hands its final payouts back to the caller instead of
  discarding them once "Start Next Hand" is clicked.
- main.js records a history entry (skipping hands where nobody actually
  won anything) before advancing to the next hand, and wires up a "Clear
  history" control that also resets the hand counter.
- A new sidebar panel lists history entries newest-first; the header
  shows a running "Hand #N" badge next to the existing subtitle.

Verified via Playwright MCP: seated two players, resolved a pot, and
confirmed the header's hand counter incremented, the history panel
listed the payout, the entry survived a full page reload (localStorage
persistence), and Clear History reset both the log and the counter. No
console errors during the flow.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01C3NiiUDimoKDJ8GjC3KL3x
jheaps added 1 commit 2026-08-31 17:26:17 -06:00
A dedicated dealer needs a paper trail that outlives the browser tab, not
just a scrollable in-app panel — the Export CSV button downloads the full
resolved-pot log (hand #, time, pot, payouts) for recordkeeping or a
disputed chip count after the session ends.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015bnp7xKUPFFSpwkYNFaPgb
jheaps added 1 commit 2026-08-31 17:37:55 -06:00
The hand log answered "what happened in hand 12"; it couldn't answer "what
does Alice owe". Each resolved pot now records a per-seat ledger (what that
player put in, what they took down) alongside the payouts, and a Session
Standings panel sums it into one row per player — paid in, won, net, sorted
by who's up. The CSV export carries the same table, so one file covers both
the hand-by-hand trail and the cash-out numbers.

Keyed by seat id rather than name, so renaming or reseating a player doesn't
split their totals. Hands recorded before this change have no ledger and are
skipped rather than counted wrong.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015bnp7xKUPFFSpwkYNFaPgb
jheaps changed title from Add a persistent hand history log to the Texas Hold'em dealer tool to Give the Hold'em dealer a session record: hand history, CSV export and standings 2026-08-31 17:38:08 -06:00
jheaps merged commit 71b33f8623 into master 2026-08-31 18:31:19 -06:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: jheaps/JoshHeaps.Net#14