Add pagination to GET /api/competitions and fix participating_in leak - #2493
Open
ihsaan-ullah wants to merge 1 commit into
Open
Add pagination to GET /api/competitions and fix participating_in leak#2493ihsaan-ullah wants to merge 1 commit into
ihsaan-ullah wants to merge 1 commit into
Conversation
Paginate the competition list endpoint (LargePagination), and update
the Organizing/Participating tabs in competition_list.tag to
consume the new {count, next, previous, results} shape with
next/previous buttons (hidden on a single page). Fix the navbar
competition search to read response.results instead of assuming a
bare array.
Fix participating_in filter incorrectly including competitions the
user organizes: creators/collaborators are auto-added as approved
participants (Competition.save()), so they leaked into the
Participating tab. Applied the same fix to the public competitions
endpoint's participating_in filter and updated its tests. Added
coverage for the list endpoint's pagination and participating_in
behavior. Minor renames for clarity (change_page, tab labels).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Paginate the competition list endpoint (LargePagination), and update the Organizing/Participating tabs in competition_list.tag to consume the new {count, next, previous, results} shape with next/previous buttons (hidden on a single page).
Fix the navbar competition search to read response.results instead of assuming a bare array.
Fix participating_in filter incorrectly including competitions the user organizes: creators/collaborators are auto-added as approved participants (Competition.save()), so they leaked into the Participating tab.
Applied the same fix to the public competitions endpoint's participating_in filter and updated its tests.
Added coverage for the list endpoint's pagination and participating_in behavior.
Minor renames for clarity (change_page, tab labels).
Issues this PR resolves
competitionsapi #2481Screenshots
Organizing Tab pagination

Participating Tab pagination

No pagination when api response has only 1 page

Checklist