Repository navigation
feat: add count and page to the bulk course progress feed - #401
Merged
Merged
Conversation
Every response of GET api/fx/learners/v1/learner_courses/ (no username) now carries `count`, the total rows of the walk, and `page` (1 for the first call). The total is a COUNT over the feed's filters without the per-row columns, run once on the call without a cursor and carried in the cursor (after:page:count), so the later pages never count again. Cursors issued by v0.13.8 (a bare id) still work; their walks report count and page as null. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
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.
Summary
Every response of the bulk progress feed (
GET /api/fx/learners/v1/learner_courses/, no username) now has two new fields:count: the total rows the whole walk returns.page: 1 for the first call, then +1 pernext.{"count": 86819, "page": 1, "next": "...", "previous": null, "results": [...]}How the count stays cheap
COUNTover the feed's own filters, without the per-row columns (get_learners_progress_count; the filters are shared through_get_learners_progress_base).after:page:count. Later pages never count again.countandpageasnull.Known cost (not measured)
The first call counts the caller's whole scope. For the largest tenants (millions of enrollments) that call will be noticeably slower than today; it has not been timed on the prod replica. Pages after the first are unchanged.
Tests
tox -e py311-teak,py311-redwood,py311-sumac,quality: 100% coverage in each release, quality clean. New cases cover:countequals the rows actually walked and is the same on every page;pagegoes 1..N;countfollowsmodified_since;queryset.count()when the view has no counter.The existing
learner_courses/<username>/route is untouched.🤖 Generated with Claude Code