feat: round stats #187

Merged
eztvdpqx5 merged 3 commits from issue-185 into master 2026-03-18 17:56:20 +00:00
eztvdpqx5 commented 2026-03-13 02:24:45 +00:00 (Migrated from github.com)

Summary

  • Add a rounds collector that syncs completed rounds from the pool API, caches participant data per round, and polls current round stats every 10 minutes
  • Add round/all-time toggle to the difficulty, loyalty, and combined leaderboards on the homepage
  • Add a /rounds page showing round history with expandable participant leaderboards (difficulty + participation)
  • Add per-user round stats section on the user profile page (rank, top diff, blocks participated per round)

Details

  • Backend: New rounds-collector.ts handles syncing round metadata, fetching participants for completed rounds (with retry/backoff), and polling current round data.
    Triggered on new blocks via stratum and on a 10-min cron.
  • DB: Two new tables — rounds (round metadata) and round_participants (per-user stats per round, block_height=0 as current round sentinel). Indexed for leaderboard and
    user lookup queries.
  • API: New routes at /api/rounds, /api/rounds/current, /api/rounds/[blockHeight], and /api/user/[address]/rounds. Existing /api/leaderboard extended with
    ?round=current param.
  • Frontend: Shared useRoundLeaderboard hook replaces duplicated fetch logic in all three board components. New /rounds page with expandable round details. User profile
    shows round history with diff/blocks ranks.

Closes #185

Screenshots

image image
## Summary - Add a rounds collector that syncs completed rounds from the pool API, caches participant data per round, and polls current round stats every 10 minutes - Add round/all-time toggle to the difficulty, loyalty, and combined leaderboards on the homepage - Add a `/rounds` page showing round history with expandable participant leaderboards (difficulty + participation) - Add per-user round stats section on the user profile page (rank, top diff, blocks participated per round) ## Details - **Backend**: New `rounds-collector.ts` handles syncing round metadata, fetching participants for completed rounds (with retry/backoff), and polling current round data. Triggered on new blocks via stratum and on a 10-min cron. - **DB**: Two new tables — `rounds` (round metadata) and `round_participants` (per-user stats per round, block_height=0 as current round sentinel). Indexed for leaderboard and user lookup queries. - **API**: New routes at `/api/rounds`, `/api/rounds/current`, `/api/rounds/[blockHeight]`, and `/api/user/[address]/rounds`. Existing `/api/leaderboard` extended with `?round=current` param. - **Frontend**: Shared `useRoundLeaderboard` hook replaces duplicated fetch logic in all three board components. New `/rounds` page with expandable round details. User profile shows round history with diff/blocks ranks. Closes #185 ## Screenshots <img width="1598" height="897" alt="image" src="https://github.com/user-attachments/assets/34647635-111e-4296-beff-59f782ee9097" /> <img width="1440" height="896" alt="image" src="https://github.com/user-attachments/assets/b6efe415-cd24-4c49-bc45-d284126eb4a0" />
parabitdev (Migrated from github.com) reviewed 2026-03-13 02:24:45 +00:00
parabitdev (Migrated from github.com) approved these changes 2026-03-18 17:14:32 +00:00
parabitdev (Migrated from github.com) left a comment

Misclick, still reviewing

Misclick, still reviewing
Sign in to join this conversation.
No description provided.