kolibri
kolibri copied to clipboard
Content node tree advertises more children when a filter leaves none
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Target branch: develop
Observed behavior
/api/content/contentnode_tree/<id>/setschildren.morewhenever a full page ends before the parent's last descendant, comparingrghtvalues only.- When the request's filters exclude every child after that page, the request built from
children.morereturns 200 with nochildrenkey. include_coach_content=false, which Learn sends for learners, does this for a topic whose 12 learner resources are followed by one coach resource.languages=esdoes it for 12eschildren followed by oneenchild./api/public/v2/contentnode_tree/<id>/shares the code.
Expected behavior
children.more is null when no further child passes the request's filters.
User-facing consequences
Learn reads data.children.results from the continuation without checking for children, in loadMoreContents, loadMoreTopics and TopicsContentPage.vue. A learner in such a topic is offered more resources that do not exist.
Steps to reproduce
- Create a topic with 13 child resources, the last one with
coach_content=True. GET /api/content/contentnode_tree/<topic id>/?include_coach_content=false.- The response holds 12 children, and
children.more.paramscarriesinclude_coach_content=false,depth=2and anext__gt. GETthe same URL with those params.- The response is 200 and has no
childrenkey.
Context
- Kolibri develop at 758605b764.
- SQLite, Django test client.
Acceptance Criteria
- [ ] For the topic in the steps above, the first response's
children.moreisnull. - [ ] The same holds for a child topic whose page of 12 grandchildren is followed only by filtered-out nodes.
- [ ] A topic with 13 children that all pass the filters still returns
children.more, and its continuation returns the thirteenth child. - [ ] Both hold on the local and the public v2 tree endpoints.
- [ ] A tree request issues no more queries than it does today when no page is full.
AI usage
Written by rtibblesbot, an LLM-based coding agent (Claude Code), which found this while reviewing the branch for #15043 and reproduced the responses above with Django's test client.