-
Bug
-
Resolution: Duplicate
-
Minor
-
None
-
4.4.7, 4.5.3
-
None
The function convert_legacy_set_reference_filter_condition() (see https://github.com/moodle/moodle/blob/c64e967ce61880554dc3e4fb7d2f2328ee01b8bc/question/classes/question_reference_manager.php#L103-L115) is used for e.g.
- generating links when looking at question lists containing random questions
- populating the filter conditions form for random questions
Every time this function is called, there is a chance that the entry of the question_set_references table contains a filtercondition with the old syntax, e.g.
{"questioncategoryid":"SOME_QUESTION_CATEGORY_ID","includingsubcategories":"TRUE/FALSE","tags":["UNKNOWN_STRING, NAME_OF_SOME_QUESTION_TAG"]}I haven't deciphered what UNKNOWN_STRING was originally...
The function then extracts NAME_OF_SOME_QUESTION_TAG and ensures that the tag exists by creating it in the default tag collection (or rather the tag collection with id 1). This leads to numerous unwanted and unnecessary tags in the tag collection with id 1.
Instead it should ensure the tag is present in the tag collection for the tag area with component 'core_question' and itemtype 'question'.
The function is also used in the filter condition form. This leads to the form not containing any entry for the tag filter, because
- it translates the old filtercondition to the new format, possibly creating an id 1 collection tag
- the new format then contains the id of a tag that isn't in the question tag collection and thus will not be shown
If you then search for the old tag using NAME_OF_SOME_QUESTION_TAG, the user of course finds the question tag and can save the new filtercondition value.
After this, everything is fine for this random question. But not for the hundreds of other random questions.
I'm unsure if this bug affects more than random questions using the old filtercondition syntax. Meaning I'm not sure if the question_set_references table is used in any other way.
- duplicates
-
MDL-85369 Conversion of legacy random question filter conditions for the question area is breaking quizzes
-
- Closed
-