I'm having some problems with Moodles lesson completion. When the first student completes a lesson the process appear to work correctly, the student presses the final navigation button at the end of the lesson and is presented with the "Congratulations - end of lesson reached" page. However when the 2nd, 3rd, 4th, etc student completes the lesson they are presented with "Found more than one record in fetch() !" and this is happening with every course.
With debugging enable I can see the following:
Error code: morethanonerecordinfetch
- line 496 of /lib/setuplib.php: moodle_exception thrown
- line 169 of /lib/grade/grade_object.php: call to print_error()
- line 354 of /lib/grade/grade_item.php: call to grade_object::fetch_helper()
- line 1125 of /lib/grade/grade_item.php: call to grade_item::fetch()
- line 2015 of /lib/grade/grade_item.php: call to grade_item::fetch_course_item()
- line 294 of /lib/gradelib.php: call to grade_item->update_raw_grade()
- line 814 of /mod/lesson/lib.php: call to grade_update()
- line 734 of /mod/lesson/lib.php: call to lesson_grade_item_update()
- line 589 of /mod/lesson/view.php: call to lesson_update_grades()
if (count($instances) > 1) {
// we should not tolerate any errors here - problems might appear later
print_error('morethanonerecordinfetch','debug');
}
If i delete the extra rows the next user is able to complete the course without error but all completions afterwards will being showing the error again and the extra rows are re-inserted.
I have not been able to track down where or why these additional rows are being inserted but is causing a big problem. I'll also mention that if the user refreshes the page after seeing the "Found more than one record in fetch() !" error the page is displayed correctly and they see the "Congratulations - end of lesson reached" page.
If anyone could shed any light onto why this might be happening or what can be done to fix it that would greatly appreciated.
Thanks
This is using Moodle version 3.2.3+ (Build: 20170601)
I have also included some screenshots.