Hi all,
We’ve identified a bug. After enabling and disabling entrance exams in a course in the Schedule & Details page, then all updates in course settings are ignored. This cannot be fixed from Studio, except by re enabling entrance exams. It can also happen when importing a course from an older Open edX version.
Instructions to reproduce:
- Setup a platform with FEATURES.ENTRANCE_EXAMS set to True.
- Enable Entrance Exams in the Schedule & Settings page of a course
- Disable Entrance Exams
- Make any change in the course setting (e.g. change the display name)
- The change will not be reflected
- In the cms logs, a line like this will be shown:
2022-07-27 14:15:46,424 INFO 13 [openedx.core.djangoapps.content.course_overviews.models] [user 7] [ip 10.0.4.229] models.py:329 - Multiple CourseOverviews for course course-v1:ORG+COURSE+EDITION requested simultaneously; will only save one.
The problem is caused when trying to update the course_overview object with an empty entrance_exam_minimum_score_pct
.
This variable is set to None
and stored in the modulestore by the Settings & Details page view, when the user unticks the entrance exam option.
Then, a None value is allowed in the course_overview model which triggers an IntegrityError when trying to update the record.
I believe this problem was introduced when adding Entrance Exam capability to the learning MFE.
How to fix this?
- Checking for an empty value of
course.entrance_exam_minimum_score_pct
in the course_overview model and settingcourse_overview.entrance_exam_minimum_score_pct
to a default (maybe usingfloat(settings.ENTRANCE_EXAM_MIN_SCORE_PCT)
, which has a default value of 50 in the cms settings). This will fix this particular case, but I’m not sure if this may appear somewhere else. - I’m not sure why disabling entrance exam sets
entrance_exam_minimum_score_pct
toNone
in the modulestore. Maybe leaving this value as it is by removing this line will be enough. Anyway this will not fix the problem when importing a course with that value empty in the settings.