feat(leaderboard): add advanced filters, sorting, and server-side pagination#3010
Conversation
GSSoC Label Checklist 🏷️@Priyanshu-byte-coder — please apply the appropriate labels before merging: Difficulty (pick one):
Quality (optional):
Validation (required to score):
|
|
New feature/UI PRs are on hold during the code-quality sprint — see discussion #2651. We'll revisit this after the sprint; meanwhile tests, refactors, and bug-fix PRs are very welcome. Also note CI is currently red (5 failing checks). |
|
The leaderboard filters/sorting/server-side pagination is a useful direction, but CI is red: Type check and Build both fail (which also fails the smoke + visual runs). Please fix the type/build errors, get |
PR Description
This PR implements Issue #2981 end to end for the leaderboard with URL-driven filtering and scalable server responses.
What was done:
Added a reusable leaderboard query engine for parsing and validating page, limit, sort, range, and scope inputs.
Implemented server-side sorting and pagination so the API now returns paginated items with pagination metadata.
Added time-range aware leaderboard generation using 7d, 30d, 90d, and all-time query ranges.
Updated cache strategy to use range andscope specific cache keys, including memory and shared cache behavior.
Kept leaderboard metric views available while introducing query-based response shaping.
Updated the leaderboard page UI to support:
Sort controls (score, streak, commits, PRs)
Range controls (7d, 30d, 90d, all time)
Row limit controls (10, 25, 50)
URL-synced state persistence
Server-driven previous and next pagination controls
Result summary showing current slice and total count
Added focused tests for:
Query parsing defaults and validation
Sorting and pagination behavior
Range date calculation logic