Skip to content

Paginate leaderboard; cache rows instead of rendered page - #43

Merged
Ymax27 merged 1 commit into
Ymax27:mainfrom
Hitesh-XS:leaderboard-pagination
Oct 19, 2026
Merged

Ymax27 merged 1 commit into
Ymax27:mainfrom
Hitesh-XS:leaderboard-pagination

Conversation

@Hitesh-XS

@Hitesh-XS Hitesh-XS commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Closes #22

What i did here:

Paginates the leaderboard so contributors ranked #51+ are reachable.

Changes

  • Added LEADERBOARD_PAGE_SIZE = 50 (explore's PAGE_SIZE is untouched).
  • Ordering is now ("-total", "pk") so ranking is stable across pages.
  • Hero card and top-3 highlight bars appear on page 1 only; rank numbers continue across pages (page 2 starts at 51).
  • Pagination links below the list, adapted from _issue_list.html (without the HTMX attributes, since this is a full-page view). ?country= is preserved in every page link.
  • Caching: the leaderboard now caches the computed rows instead of the full rendered HTML, so the template renders per request. This removes the leaderboard's share of Logged-in users see the login button on Explore/Leaderboard (page cache ignores auth) #38 (anonymous navbar served to logged-in users). Explore still caches full pages and is not changed here.
  • Added test_leaderboard_pagination covering page 1 (hero, order), page 2 (no hero, rank offset), bad page numbers, and country filter persistence in page links.

Testing

pytest core/tests.py: 28 passed.

@Ymax27
Ymax27 merged commit 081412d into Ymax27:main Oct 19, 2026
1 check passed
@Ymax27

Ymax27 commented Oct 19, 2026

Copy link
Copy Markdown
Owner

Merged 🎉 Thanks a lot @Hitesh-XS, this is a really solid first PR: stable ordering, rank offset, country filter kept in the links, safe page parsing and a thorough test. And thanks for switching the leaderboard to row-level caching, that fixes the leaderboard half of #38 👏
Tiny non-blocking nits for a future PR if you feel like it: podium/rest/rest_offset are no longer used by the template, and two files are missing a trailing newline.

— Max

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.

Add pagination to leaderboard view

2 participants