But, if you can, better to use 'real' DB tools where you can directly run queries, and use commands like EXPLAIN to see what is going on.
Tim Hunt
Posts made by Tim Hunt
Yes, category 2244 has parent 2250, and category 2250 has parent 2244. That will be breaking it.
If you can work out how it got like that, that is a but we would like to fix.
But so fix this now, you need to break the cycle. Many ways you could do that but probably a safe change is
UPDATE mdl_question_categories SET parent = 2242 WHERE id = 2244
That will turn category 2244 into a top-level category. If that is not exactly what you want, you can fix it more using the Moodle UI, once the data is unbroken.
If you can work out how it got like that, that is a but we would like to fix.
But so fix this now, you need to break the cycle. Many ways you could do that but probably a safe change is
UPDATE mdl_question_categories SET parent = 2242 WHERE id = 2244
That will turn category 2244 into a top-level category. If that is not exactly what you want, you can fix it more using the Moodle UI, once the data is unbroken.
Context id is the id of the context - there is a context for each course, activity, block etc. The context leven is what type of context each context is. You have to yet understood what is going on here.
You have one particular course where the question categories in that course's question bank have got into a mess. First find that contextid. (e.g. go to the Permission -> check permissions page, and the contextid is in the URL - e.g. https://qa.moodledemo.net/admin/roles/check.php?contextid=25)
Then, in the database of the broken site, look at all the rows from
SELECT * FROM mdl_question_categories WHERE contextid = ...
and, as I already said, look at how the ids in the parent column link those into a tree structure (or a broken structure with a cycle).
You have one particular course where the question categories in that course's question bank have got into a mess. First find that contextid. (e.g. go to the Permission -> check permissions page, and the contextid is in the URL - e.g. https://qa.moodledemo.net/admin/roles/check.php?contextid=25)
Then, in the database of the broken site, look at all the rows from
SELECT * FROM mdl_question_categories WHERE contextid = ...
and, as I already said, look at how the ids in the parent column link those into a tree structure (or a broken structure with a cycle).
The problem is not with the contexts. the problem is the question categories (with that contextid).
If you really want to develop your understatnding of how this all works, do some experiments yourself. Log in with a student-like account, and move around a quiz attempt, and answer questions, and look at how that appears in the logs and in the response history. (You can lot in as one user in your browser, and a different user in a private browsing session, or a different browser.) For an even fuller picture, look at the server HTTP logs too.