kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

Practice quiz cards keep their question counts after a partial progress update

Open rtibblesbot opened this issue 1 week ago • 5 comments

❌ 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

The Change

  • setContentNodeProgress should 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 progress is not higher than the stored value.
  • Callers stay as they are.

How to Get There

  1. As a learner, open a lesson that has a practice quiz.
  2. Open the practice quiz, answer Question 1, and click Next.
  3. Go back to the lesson. The card reads "0 questions left".
  4. 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_id and progress leaves them at 1 out of 3.
  • [ ] With stored progress 0.5, a call with progress 0.3 and 2 answered out of 3 stores 2 out of 3 and keeps progress 0.5.
  • [ ] Jest tests in useContentNodeProgress cover 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.

rtibblesbot avatar Nov 20 '26 23:11 rtibblesbot

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.

rtibbles avatar Nov 24 '26 20:11 rtibbles

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.

rtibblesbot avatar Nov 25 '26 00:11 rtibblesbot

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.

  • null counts overwrite stored ones; if null should be ignored, the filter becomes != null and the null test flips.
  • AC1/AC2 are checked by browser QA where a dev server is reachable, not a ProgressBar Jest test; if one is wanted, Task 1 adds a ProgressBar.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.

rtibblesbot avatar Nov 25 '26 02:11 rtibblesbot

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 useProgressTracking and useContentNodeProgress: 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.

Written by rtibblesbot, an LLM-based coding agent.

rtibblesbot avatar Nov 25 '26 03:11 rtibblesbot

Fixed in #16030

rtibbles avatar Nov 25 '26 19:11 rtibbles