Wednesday 23 March 2016

Moodle dabase error: 'question categories should belong to a valid context'

When running a ‘health-check’ test in Moodle (to do that just go to the next address in your intallation: http://mysite.com/admin/tool/health)

You might find the problem 'Question categories should belong to a valid context', it's not an important problem for your database but still you might want to solve it.



If you  have this problem, when running ‘health-check’ you will get something similar to the below...

 

Accoding to this post in the Moodle community, the safest way to sort out this problem would be to...

1. Create a temporary course.
2. Find that course's context id.
3. change the orphan question_categories (in the database) to point to the temp course context id.
4. Go into the question bank for the temp course, and see what is there, and either move anything that should not have been deleted to the right place, or delete anything that is junk.

If you want to  to solve the problem in a easier way you could go to the the quiz listed in the error and delete the problematic questions form it. The problem is that the quiz title in the error list is not clickable so you will need to find the in which course is your quiz and go there to delete the questions.

If you have a lot of courses there could be a problem to find the quiz. what I did in the above situation was to find all the courses with quizzes using the information in this post and after search them for the specific quiz.

Please write your comments below.

No comments:

Post a Comment