-
Bug
-
Resolution: Fixed
-
Minor
-
2.9.1, 3.8.3, 3.9.1
-
MOODLE_29_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE
-
MOODLE_310_STABLE, MOODLE_39_STABLE
-
MDL-50955-master -
-
3
-
4.0 holding pattern 7, 4.0 holding pattern 8
Sites running 3.7 or earlier may have bad completion configuration, which persists into 3.8, 3.9 or master when upgrading. This leads to an error when viewing the module as a student.
Replication instructions
1. Create a site on 3.7
2. Create a course, with activity completion enabled
3. Enrol a few students
4. Create a lesson module, setting:
- Grade type = none
- Activity completion: 'Show activity as complete when conditions are met' and tick the following:
- 'require grade'
- 'require view'
5. Click 'Save and display'
6. Now, create a content page for the lesson and save that.
7. Checkout master and run the site upgrade.
8. Once upgrade is complete, log in to the site as a student
9. View the lesson activity and notice the error
This occurs because 'require grade' is not compatible with 'grade type' = 'none'. This is not possible in new installs, but legacy sites upgrading may still have bad data. We should fix this if possible/sensible.
Workaround:
Re-save the activity in a 3.8 or newer site.
Original description (for posterity only - affects 3.7 and earlier versions of Moodle only)
Pre-requisites :
Course activity completion is enabled at site level
Steps to replicate:
1) Create course and enable course activity completion.
2) Turn editing on
3) Add lesson module with following settings:
Name: anything
Description: anything
Grade type: none
Activity completion - completion tracking : when conditions are met
Activity completion - require view : tick
Activity completion - require grade: tick
Activity completion -Expect completed on : tick and leave as today
4) Click 'save and display'
Result:
Debug info: Cannot find grade item for 'lesson'
cm '16' matching number '0'
Error code: err_system
Stack trace:
line 1329 of /lib/completionlib.php: moodle_exception thrown
line 650 of /lib/completionlib.php: call to completion_info>internal_systemerror()-
line 583 of /lib/completionlib.php: call to completion_info>internal_get_state()-
line 707 of /lib/completionlib.php: call to completion_info>update_state()-
line 53 of /mod/lesson/view.php: call to completion_info>set_module_viewed()-
NOTE: I've found that this affects other modules too, so probably an issue with the completionlib as opposed to the module itself.