Practice quiz cards keep their question counts after a partial progress update
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Overview
After a learner leaves a practice quiz, its card in Learn says "0 questions left", or "Score: 0%" once the quiz is done, until the page is reloaded. setContentNodeProgress replaces a node's whole question-count entry, and most of its callers pass only content_id and progress. The card should keep showing the last counts the server returned.
Complexity: Low Target branch: release-v0.20.x
Context
setContentNodeProgresswritesnum_question_answered,num_question_answered_correctlyandtotal_questionson every call, asundefinedwhen the caller omits them. It writes nothing whenprogressis lower than the stored value.- These callers pass only
content_idandprogress:ContentPage.vue#L286, on every progress changeContentItem.vue#L150useLearnerResources.js#L46useCourseContentProgressTracking.js#L65
- With
total_questionsundefined,ProgressBar.vuereturns 0 for bothremainingQuestionsandscore. /api/content/contentnodeprogress/returns the right counts, for examplenum_question_answered: 1,total_questions: 3.
The Change
setContentNodeProgressshould overwrite only the count fields its argument includes, and keep the stored value of any it omits.- Count fields should update whenever they are present, including when
progressis not higher than the stored value. - Callers stay as they are.
How to Get There
- As a learner, open a lesson that has a practice quiz.
- Open the practice quiz, answer Question 1, and click Next.
- Go back to the lesson. The card reads "0 questions left".
- Reload the page. The card reads "2 questions left".
Acceptance Criteria
- [ ] After steps 1–3, the card reads "2 questions left" without a reload.
- [ ] After finishing a practice quiz and returning to the lesson, the card shows the quiz's score, not "Score: 0%".
- [ ] With stored counts of 1 answered out of 3, a call with only
content_idandprogressleaves them at 1 out of 3. - [ ] With stored progress
0.5, a call withprogress0.3and 2 answered out of 3 stores 2 out of 3 and keeps progress0.5. - [ ] Jest tests in
useContentNodeProgresscover both calls.
AI usage
Claude Code found this during browser QA of the contentnode progress changes, reproduced it on the dev server and drafted the report. I chose to merge counts in setContentNodeProgress rather than change every caller, and Claude Code rewrote it as a task.
Rewritten as a task: setContentNodeProgress merges the count fields it's given instead of replacing the entry, and counts update even when progress doesn't increase. Callers stay as they are. Targets release-v0.20.x.
Checked the rewritten body against this: merge-only count fields, counts updating without a progress increase, callers unchanged and the release-v0.20.x target are all in The Change and Acceptance Criteria. No further edits.
Plan: Practice quiz cards keep the last server-returned question counts after progress-only updates.
- [ ] Merge count fields in
setContentNodeProgress - [ ] Browser QA of the learner card
- [ ] Self-review the produced code
Assumptions — the issue did not settle these; say so if one is wrong.
nullcounts overwrite stored ones; ifnullshould be ignored, the filter becomes!= nulland the null test flips.- AC1/AC2 are checked by browser QA where a dev server is reachable, not a
ProgressBarJest test; if one is wanted, Task 1 adds aProgressBar.spec.js. - The return fetch carries the current counts with a progress below the store's (static trace:
QuizRenderer/index.vue:391-397,useProgressTracking.js:438,:591,:650,handlers.js:17-18), so Task 1 alone meets AC1. If QA finds the response stale, that fix goes to a follow-up issue; if it belongs here, a caller changes, against "Callers stay as they are".
Written by rtibblesbot, an LLM-based coding agent.
Decided without asking; a reply here changes it.
- A learner who returns to the lesson before the first answer's save is stored still sees a stale count: that goes to a follow-up issue, now queued, and is not fixed on this branch.
- Ran both orderings in Jest against the real
useProgressTrackinganduseContentNodeProgress: the save is sent when Next is clicked. Save stored first, the card reads "2 questions left". Lesson fetch answered first, it reads "3 questions left" until the lesson loads again; release-v0.20.x reads "0 questions left" there. - For fixing here: AC1 is unmet in that one ordering.
- For a follow-up: the fix is new coordination between the quiz save and the progress fetch, outside
setContentNodeProgress; the branch did not cause the ordering; the issue keeps callers as they are. - The follow-up outweighed: the harm is a count one too high on one card, corrected on the next lesson load, while the fix reaches the quiz save and every page that fetches progress on entry.
- On release-v0.20.x the issue's steps on a new quiz read "2 questions left" when the save is stored first; only the fetch-first ordering gave "0 questions left". QA that returns immediately after Next will read "3 questions left" on this branch.
- Ran both orderings in Jest against the real
Written by rtibblesbot, an LLM-based coding agent.
Fixed in #16030