-
Bug
-
Resolution: Fixed
-
Minor
-
4.2.2
-
MOODLE_402_STABLE
-
MOODLE_402_STABLE, MOODLE_403_STABLE
-
MDL-79527_403 -
After restore course with many top question categories gets {question_categories}.parent = some number which can be and from other course.
It will not make big deal but in questionlib.php
$subcategories = $DB->get_records_select_menu('question_categories', "parent $in", $params,
null, 'id,id AS id2');
when collecting questions from sub categories it not use contextid and if in other course question bank category.parent are same id as selecting it will take this category too. This problem are not only in question bank view, but exist in quiz preview/attempt.
DB select to get all categories which parent and contextid are not same.
SELECT *
FROM {question_categories} c1
WHERE EXISTS (
SELECT 1
FROM {question_categories} c2
WHERE c2.id = c1.parent
AND c2.contextid <> c1.contextid
)
Quick and boring fix are go to course question bank and move category to other level.
Couldn't reproduce on test system, but teacher some how made parent duplicates to other courses. It could be restore problem when setting wrong parent in question top categories, but select question sub categories can have contexid too.
- caused a regression
-
MDL-81482 PHPUnit tests test_question_categorylist and test_question_categorylist_bad_data are failing
-
- Closed
-