Skip to content

Local-first batch sessions and judging hub#49

Merged
kronosapiens merged 1 commit intomainfrom
kronosapiens/judging-hub-ui
Feb 24, 2026
Merged

Local-first batch sessions and judging hub#49
kronosapiens merged 1 commit intomainfrom
kronosapiens/judging-hub-ui

Conversation

@kronosapiens
Copy link
Collaborator

Summary

Restructured judging to use batch sessions with local-first state and added a public-facing judging hub.

  • 10-pair sessions fetched upfront; votes stored locally; batch submitted when complete
  • Anyone can judge without auth; localStorage persists sessions across tab close (24h TTL)
  • New GET/POST /:slug/session endpoints; removed old per-vote /:slug/pair and /:slug/vote
  • Back button now trivial (array index decrement)
  • Added /judge hub listing all game jams with entry/judge/vote stats
  • Added homepage CTA to make judging discoverable

Implementation Details

Backend: selectSessionPairs() generates 10 pairs using Beta-distribution uncertainty sampling (authenticated judges) or random selection (anonymous). Cross-user session guards prevent submitting another user's votes.

Client: Rewrote useJudging hook as local-first reducer with localStorage persistence and proper TTL management. Removed login gate; review screen shows submit button for authenticated users or login nudge for guests.

Quality: Fixed 5 edge cases including fetchedAt TTL reset, cross-user guard false negative, NaN validation, startNewSession screen flash, and sessions count persistence.

Test Plan

  • Anonymous flow: Visit /judge/gj8, vote on pairs locally, see login nudge at session end
  • Authenticated flow: Log in, complete session, submit votes to database
  • Persistence: Vote on 3 pairs, close tab, reopen—should resume at pair 4
  • Back button: Vote, go back, change vote, continue—works smoothly
  • Session expiry: Manually set fetchedAt to >24h ago, reload—fetches fresh session

🤖 Generated with Claude Code

Restructure judging flow to use batch sessions with localStorage persistence:
- Fetch 10 pairs upfront; votes stored locally; batch submit when session complete
- Anyone can judge without auth; only authenticated judges can submit to DB
- New GET/POST /:slug/session endpoints replace old per-vote /:slug/pair and /:slug/vote
- Removed per-vote round-trip model; back button now trivial array navigation
- Sessions persist across tab close with 24h TTL and cross-user session guards

Add new judging hub page at /judge listing all game jams with stats (entry/judge/vote counts).
Add homepage CTA button to make judging more discoverable.
Add proper validations and edge case fixes (NaN/Infinity checks, session TTL preservation).

Backend: selectSessionPairs() samples without replacement using variance weighting.
Client: useJudging hook rewritten as local-first reducer with useState for auth.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@kronosapiens kronosapiens merged commit 69c47a9 into main Feb 24, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant