When disabling Entrance Exams in Studio (Schedule & Details), the field entrance_exam_minimum_score_pct is set to None. This value later propagates into the CourseOverview model, which expects a float. Because the DB column is NOT NULL, this results in an IntegrityError and silent failures when updating course settings.
This problem was introduced when Entrance Exam support was extended to the Learning MFE (commit d43ece5.
Examples of the Issue
- Reported by community member (Aulasneo)
- After disabling entrance exams, changing course settings (e.g., display name) does not persist.
- Workaround: re-enable entrance exams or run a shell script to reset entrance_exam_minimum_score_pct=50.
Discussion link
- Issue I faced personally
- My course start date was syncing correctly in Mongo but not in MySQL (CourseOverview), causing discrepancies.
- Some parts of the course showed one start date, while others showed another.
- I had to enable entrance exams, then disable them to force dates to sync again.
- After disabling, changing the start date once again failed to propagate due to the same None value problem.
Both cases stem from the same root cause: entrance_exam_minimum_score_pct=None breaks CourseOverview updates.
Root Cause
- In Studio, disabling entrance exams sets:
entrance_exam.py (line 224–229)
course.entrance_exam_minimum_score_pct = None
-
In CourseOverview, the None is allowed to pass through until saving:
models.py (line 262–265)
-
During update, the DB rejects the null value → IntegrityError → subsequent course setting changes fail.
Proposed Fix
- Sanitize None before saving in CourseOverview
models.py (line 301)
if course.entrance_exam_minimum_score_pct is None:
course_overview.entrance_exam_minimum_score_pct = float(settings.ENTRANCE_EXAM_MIN_SCORE_PCT) # default=50
else:
course_overview.entrance_exam_minimum_score_pct = course.entrance_exam_minimum_score_pct
- Avoid writing None from Studio
entrance_exam.py (line 226)
Instead of setting None, set the default or leave unchanged:
course.entrance_exam_minimum_score_pct = settings.ENTRANCE_EXAM_MIN_SCORE_PCT
Impact
- Fixes course settings updates failing silently.
- Ensures consistency between Mongo (modulestore) and SQL (CourseOverview).
- Resolves both reported cases:
- Display name not updating (Aulasneo)
- Start date desync (my case)
- Prevents regressions when importing older courses missing this field.
Next Steps
I will prepare a PR for this fix once it is verified by someone from the community.