Skip to content

fix: race condition caused duplicate course progress#2411

Merged
raizasafeel merged 1 commit into
frappe:developfrom
raizasafeel:fix/course-progress
May 19, 2026
Merged

fix: race condition caused duplicate course progress#2411
raizasafeel merged 1 commit into
frappe:developfrom
raizasafeel:fix/course-progress

Conversation

@raizasafeel
Copy link
Copy Markdown
Contributor

@raizasafeel raizasafeel commented May 19, 2026

Summary

  • Concurrent save_progress functions calls create duplicate LMS Course Progress rows for the same (member, lesson) before, now:
    • Added a before_insert that raises UniqueValidationError if row already exists
    • Wrapped the .save() calls in save_progress with try/except so duplicate inserts are silently ignored.
    • Added patch for cleaning up existing duplicates
    • Added a test for making sure duplicates are no longer created

@cypress
Copy link
Copy Markdown

cypress Bot commented May 19, 2026

lms    Run #3683

Run Properties:  status check passed Passed #3683  •  git commit 3a609a57e9 ℹ️: Merge 9081245dccb1c977e392dfda03e624c335681834 into 4860cf340b567bb1e1bf592ff795...
Project lms
Branch Review fix/course-progress
Run status status check passed Passed #3683
Run duration 00m 45s
Commit git commit 3a609a57e9 ℹ️: Merge 9081245dccb1c977e392dfda03e624c335681834 into 4860cf340b567bb1e1bf592ff795...
Committer Raizaaa
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 1
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 1
View all changes introduced in this branch ↗︎

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 65.21739% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 47.84%. Comparing base (41fb007) to head (9081245).
⚠️ Report is 7 commits behind head on develop.

Files with missing lines Patch % Lines
lms/lms/doctype/course_lesson/course_lesson.py 0.00% 8 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2411      +/-   ##
===========================================
+ Coverage    47.74%   47.84%   +0.09%     
===========================================
  Files          150      150              
  Lines         6658     6680      +22     
===========================================
+ Hits          3179     3196      +17     
- Misses        3479     3484       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@raizasafeel raizasafeel merged commit cac0a8e into frappe:develop May 19, 2026
8 of 9 checks passed
@raizasafeel raizasafeel deleted the fix/course-progress branch May 19, 2026 06:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants