I have a course that contains a quiz that is generating fetch() errors. The error appears after finishing a quiz associated with a course. I am logged in as trainee. Quiz finishes, but when I return to view grades, I get this fetch error.
Error code: more than one record in fetch()
- line 463 of /lib/setuplib.php: moodle_exception thrown
- line 163 of /lib/grade/grade_object.php: call to print_error()
- line 326 of /lib/grade/grade_item.php: call to grade_object::fetch_helper()
- line 980 of /lib/grade/grade_item.php: call to grade_item::fetch()
- line 1010 of /lib/gradelib.php: call to grade_item::fetch_course_item()
- line 84 of /grade/report/user/index.php: call to grade_regrade_final_grades()
Rest of the course works perfectly. But, I cannot redo the quiz, enter the quiz, or even create a new quiz activity in the related course area. It is impossible to do anything with the quiz, except delete it, which would be devastating to my work schedule.
My understanding at this point is that the fetch() errors are caused by a duplicate record in the database. I have looked through the database and can't find the problem. Have even tried the solution given in https://tracker.moodle.org/browse/MDL-31441, but not sharp enough to figure it out.
So, my thought for a solution is this: Can I export the course, absent database records, import it into a new course. and then delete the old course, thereby eliminating the offending database records? I am using Moodle 2.6 most recent release, with Essential 2.7. Database is mySQL, apache server, php 5.4.
Any thoughts on this approach or alternatives would be very gratefully appreciated. I don't want to do it, if I'll make things worse. But I do have backups, so I can do it if it makes sense.