kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

Number repeated exercise tries from the highest existing level

Open rtibbles opened this issue 2 weeks ago • 3 comments

🙂 Looking for an issue? Welcome! This issue is open for contribution. If this is the first time you’re requesting an issue, please:

  • Read Contributing guidelines carefully. Pay extra attention to Using generative AI. Pull requests and comments that don’t follow the guidelines won’t be answered.
  • Confirm that you’ve read the guidelines in your comment.

Overview

When a learner repeats an exercise, the progress tracking API numbers the new try as the most recently updated try's level plus one, not the highest level plus one. If an older try was updated after a newer one, the new try reuses an existing level and returns a 500.

Complexity: Low Target branch: develop

Context

  • On develop at fe298f5449: complete tries 1 and 2 of an exercise, send a PUT /api/logger/trackprogress/<id>/ with time_spent_delta for try 1's session, then POST /api/logger/trackprogress/ with "repeat": true. The new mastery log gets level 2, and saving it raises IntegrityError: UNIQUE constraint failed: logger_masterylog.id (learner).
  • progress_tracking.py#L600 takes the latest log by end_timestamp, and #L633 adds one to its level.
  • Sync can merge tries from two devices out of order, with the same result.

The Change

  • A new try's level should be one more than the highest existing level.

Acceptance Criteria

  • [ ] The sequence under Context returns 200 and creates a try at level 3.
  • [ ] A test covers repeating after an older try was updated.

AI usage

I had Claude Code sweep Kolibri for crashes and wrong results caused by data that sync, soft deletion or concurrent writes can create, and reproduce each one. I chose the grouping. Claude Code drafted the issue.

rtibbles avatar Nov 15 '26 20:11 rtibbles

Hi! 👋

This issue is available for contribution and supports self-assignment. Here's how to get started:

  • Comment /assign to assign yourself to this issue
  • You can have up to 2 issues assigned at a time across all community repos
  • Dropping an issue has a 7-day cooldown before the slot opens up
  • Link your pull request to this issue when you submit it

📖 Read the Contributing guidelines before starting.

Are you preparing for Google Summer of Code? See our GSoC guidelines.

learning-equality-bot avatar Nov 15 '26 21:11 learning-equality-bot

/assign

rajdhruvsingh avatar Nov 16 '26 04:11 rajdhruvsingh

Hi! 👋

You've been assigned to this issue. Here's what to do next:

  • Read the issue description carefully and make sure you understand the requirements
  • Link your pull request to this issue when you submit it
  • If you can no longer work on this, unassign yourself so others can pick it up

Good luck! 😊

Are you preparing for Google Summer of Code? See our GSoC guidelines.

learning-equality-bot avatar Nov 16 '26 04:11 learning-equality-bot