Skip to content

feat(ranking): unify & fix pagination#450

Open
ZephyrNova47 wants to merge 1 commit intoVNOI-Admin:masterfrom
ZephyrNova47:feat/pagination-submission
Open

feat(ranking): unify & fix pagination#450
ZephyrNova47 wants to merge 1 commit intoVNOI-Admin:masterfrom
ZephyrNova47:feat/pagination-submission

Conversation

@ZephyrNova47
Copy link
Contributor

Add pagination for Contest Ranking tab

Description

Implement server-side pagination for the Ranking tab in contests. The pagination uses the canonical ?page= query parameter and renders once at the bottom of the table (no duplicate pager at the top). The default page size is 200 users per page.

Type of change: New feature


What

This PR introduces pagination to the contest Ranking page and ensures it integrates cleanly with the existing auto-refresh and filtering behaviors.

  • Server-side pagination

    • Uses the standard ?page= query parameter (e.g., /contest/<key>/ranking/?page=2).
    • Page size: 200 users per page.
    • Compatible with all existing query parameters (e.g., show_virtual, filters).
  • Template changes

    • Wrap the ranking table in #rank-partial and include common/pagination.html once at the bottom.
    • Hide any pagination that might appear inside the partial:
      #rank-partial .pagination,
      #rank-partial nav.pagination,
      #rank-partial ul.pagination { display: none !important; }
    • Use the default site pagination but restyle it to match the previous black-button appearance (via CSS only).
  • JavaScript changes

    • The periodic AJAX refresh now only replaces #ranking-table, avoiding overwriting the bottom pagination bar.
    • After each refresh, pagination inside the partial (if present) is removed.
    • Query-string parameters are preserved across reloads and when toggling “Show virtual participations”.

Why

  • Ranking pages with hundreds/thousands of participants are heavy to render and scroll.
  • Pagination improves performance, accessibility, and usability.
  • Keeping a single, consistent pager at the bottom avoids visual noise and accidental routing differences.

Fixes: N/A (feature work)


How Has This Been Tested?

Environment

  • Local dev server (DEBUG=True), MariaDB.
  • Contest key: seed-test-0001.
  • Seeded ~1000+ real participations with submissions.

Steps

  1. Open /contest/seed-test-0001/ranking/ and confirm:
    • Only one pagination bar is visible (at the bottom).
    • Current page is highlighted.
    • First/Prev/Next/Last buttons work and keep the ?page= format.
  2. Click into specific pages:
    • Direct links like ?page=2, ?page=5, etc. load correctly.
    • Deep links reload to the right page after refresh.
  3. Verify query string preservation:
    • Toggle Show virtual participations and confirm the selection persists when paging and refreshing.
    • If additional filters are active, ensure they remain applied across pages.
  4. Wait for the auto refresh (10s) and confirm:
    • Ranking table updates.
    • Bottom pager stays intact (not duplicated or removed).
  5. CSV export (if enabled for non-ICPC):
    • Works on the current page view and ignores hidden rows.
  6. Visual check:
    • Pager matches the “black button” look & feel via CSS (no custom routing).

Expected Results

  • All pager links point to ?page=<n> and work correctly.
  • No top pager remains; only the single bottom pager is visible.
  • No regressions in tooltips, organization filter, or admin actions.

Checklist

  • I have explained the purpose of this PR.
  • I have performed a self-review of my own code.
  • I have commented code where helpful (templates/JS).
  • I have made corresponding documentation / in-code notes where relevant.
  • No breaking changes to URLs; uses canonical ?page= format.
  • Verified behavior with 500+ participants and periodic refresh.
  • Screenshots attached in the PR (if applicable).

By submitting this pull request, I confirm that my contribution is made under the terms of the AGPL-3.0 License.

@ZephyrNova47 ZephyrNova47 force-pushed the feat/pagination-submission branch from 977cd71 to 9739fa5 Compare October 14, 2025 09:08
@magnified103 magnified103 linked an issue Dec 15, 2025 that may be closed by this pull request
@leduythuccs
Copy link
Contributor

This seem big, we will revisit it later

@leduythuccs leduythuccs added the enhancement New feature or request label Jan 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Contest ranking pagination

2 participants