Hi, I'm experiencing a strange behavior and I've done a lot of investigation in order to understand the scenario.
It all started few days ago, after I have upgraded our installation from 3.5.4 to 3.6.2.
When moving a copy of a Quiz from a section to another with different visibility, an inconsistency is created with course modules. After that, if you open it you'll get an error page (see the attached image named Moved quiz (copy) Exception.png).
You'll also get an error entering in any other quiz or activity in the same course that has grading (ie. Assign) and also entering the Gradebook. Any other activity without grading (ie. Forum) works fine.
Thinking about a caching error, I've tried to purge caches, restart apache or mysql but none of these solved the error.
I've found that executing the CLI script fix_course_sequence.php solves the problem. After that I've cheched the course_sections table and, just after moving, the course module id of the moved quiz is missing from any section sequence (before moving it is correctly present in the original section).
The fix_course_sequence.php essentially calls two methods:
- course_integrity_check
- rebuild_course_cache
Said that, the section sequence error could be a side effect but something inside course_integrity_check and rebuild_course_cache solve the problem. Calling them separately doesn't solve the problem. You need to call them both.
Now, after writing a bible, I'll write instruction to reproduce the problem.
You need a course with two o more sections in a course, with at least one visible and one hidden.
Steps to reproduce the error:
- Create a visible Quiz in the visible section (the questions inside the quiz are not needed)
- Duplicate the Quiz
- Move the copy from the visible section to the hidden section
- Open the Quiz and you'll get an Invalid course module ID error page (see the attached image named Moved quiz (copy) Exception.png)
- Turn back to the course and open the original quiz. You'll get again an Invalid course module ID error page but with different stack trace (see the attached image named Other quizzes Exception.png).
- Turn back to the course and open the gradebook. You'll get the previous error page.
Variants that DO NOT cause the error:
- After step 2 and before step 3
- Open the copy
- Turn back to the course
- After step 2 and before step 3
- Open the gradebook
- Turn back to the course
- After step 1 and before step 2
- Change the visibility of the created quiz to hidden
- Instead of step 3
- Move the copy from the current section to another with the same visibility
Thanks,
Giorgio
- has a non-specific relationship to
-
MDL-72771 Error when duplicating Quizzes in certain cases
-
- Closed
-