DESCRIPTION
The behavior described below can only be replicated with debug messages set to "DEVELOPER: extra Moodle debug messages for developers". The value of "Display debug messages" does not matter.
An instructor is attempting to move activities within a course section. If the course section has an access restriction based on the grade on another activity, then activities within the course section cannot be moved.
When the instructor drags an activity to a new location, the activity become greyed out as though it is hidden. The response to GET /course/rest.php silently returns an error (documented below). If you try to select Show from the edit menu of the relocated activity another error is presented. Upon reloading the course the activity is returned to its original location.
STEPS TO REPLICATE
1. Go to Site administration > Development > Debugging.
2. Set Debug messages to "DEVELOPER: extra Moodle debug messages for developers".
3. Create a new course.
4. Enroll a user into the course with the teacher role.
5. Add a few activities to the first course section. Make sure at least one of the activities is graded.
6. Add a few activities to the second course section.
7. Edit the second course section. In the Restrict access section add a grade restriction based on the grade of an activity in the course. Save changes.
8. Login as the teacher.
9. Turn editing on.
10. Click on the intersecting arrows next to an activity in the first course section and drag-n-drop it to a new location within the course section. Observe that the activities are successfully re-ordered.
11. Click on the intersecting arrows next to an activity in the second course section and drag-n-drop it to a new location within the course section.
OBSERVED BEHAVIOR:
The activity appears to be moved but is greyed out as though it is hidden. Reload the course and find that the activity is back to its original location.
If you open the browser tools prior to step 9 above, and look at the response to GET /course/rest.php you will observe this error response:
{"error":"Coding error detected, it must be fixed by a programmer: $PAGE->context was not set. You may have forgotten to call require_login() or $PAGE->set_context()","errorcode":"codingerror","stacktrace":"* line 453 of \/lib\/pagelib.php: coding_exception thrown\n* line 773 of \/lib\/pagelib.php: call to moodle_page->magic_get_context()\n* line 1420 of \/lib\/weblib.php: call to moodle_page->__get()\n* line 1396 of \/lib\/grade\/grade_item.php: call to format_string()\n* line 192 of \/availability\/condition\/grade\/classes\/condition.php: call to grade_item->get_name()\n* line 145 of \/availability\/condition\/grade\/classes\/condition.php: call to availability_grade\\condition::get_cached_grade_name()\n* line 159 of \/availability\/classes\/condition.php: call to availability_grade\\condition->get_description()\n* line 526 of \/availability\/classes\/tree.php: call to core_availability\\condition->get_standalone_description()\n* line 476 of \/availability\/classes\/tree.php: call to core_availability\\tree->get_full_information_recursive()\n* line 216 of \/availability\/classes\/info.php: call to core_availability\\tree->get_result_information()\n* line 2647 of \/lib\/modinfolib.php: call to core_availability\\info->is_available()\n* line 2610 of \/lib\/modinfolib.php: call to section_info->get_available()\n* line 1809 of \/lib\/modinfolib.php: call to section_info->__get()\n* line 1830 of \/lib\/modinfolib.php: call to cm_info->obtain_dynamic_data()\n* line 1162 of \/lib\/modinfolib.php: call to cm_info->get_user_visible()\n* line 2857 of \/lib\/moodlelib.php: call to cm_info->__get()\n* line 56 of \/course\/rest.php: call to require_login()\n","debuginfo":"\nError code: codingerror","reproductionlink":"http:\/\/bwinstead-sandbox.mrooms.net\/"}
|
|
EXPECTED BEHAVIOR:
The activity is successfully moved to its new location.
ADDITIONAL INVESTIGATION NOTES
Replicated using both Clean and More themes.
CLIENT IMPACT
The reporting institution uses grade access restrictions extensively throughout their courses. While developer level debug messages does not need to be enabled on a day-to-day basis, this does present a challenge when developer debugging is needed while investigating other issues.
- duplicates
-
MDL-41809 Call to format_text during course cache building causes debugging message
- Closed