From 95b0f86ed36a5fdd68f8fb0a137746b0fa477c41 Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Mon, 11 Apr 2022 10:26:11 +0100 Subject: [PATCH] MDL-74470 quiz: fix typos & small bug from MDL-74255. I think that, because how PHP works, the MDL-74255 bug (lack of explode) generally does not break anything, which is why no tests failed. Still. Good to fix. --- mod/quiz/classes/question/bank/qbank_helper.php | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/mod/quiz/classes/question/bank/qbank_helper.php b/mod/quiz/classes/question/bank/qbank_helper.php index fccb4ec6d56..3bfc1ab5260 100644 --- a/mod/quiz/classes/question/bank/qbank_helper.php +++ b/mod/quiz/classes/question/bank/qbank_helper.php @@ -19,7 +19,6 @@ namespace mod_quiz\question\bank; use core_question\local\bank\question_version_status; use core_question\local\bank\random_question_loader; use qubaid_condition; -use quiz_attempt; defined('MOODLE_INTERNAL') || die(); @@ -130,7 +129,7 @@ class qbank_helper { -- This way of getting the latest version for each slot is a bit more complicated -- than we would like, but the simpler SQL did not work in Oracle 11.2. - -- (It did work find in Oracle 19.x, so once we have updated our min supported + -- (It did work fine in Oracle 19.x, so once we have updated our min supported -- version we could consider digging the old code out of git history from -- just before the commit that added this comment. -- For relevant question_bank_entries, this gets the latest non-draft slot number. @@ -202,17 +201,14 @@ class qbank_helper { /** * Get this list of random selection tag ids from one of the slots returned by get_question_structure. * - * @param \stdClass $slotdata one of the array elements returend by get_question_structure. + * @param \stdClass $slotdata one of the array elements returned by get_question_structure. * @return array list of tag ids. */ public static function get_tag_ids_for_slot(\stdClass $slotdata): array { - if (empty($slot->randomtags)) { - return []; - } - $tagids = []; - foreach ($slotdata->randomtags as $tag) { - $tagids[] = $tag->id; + foreach ($slotdata->randomtags as $taginfo) { + [$id] = explode(',', $taginfo, 2); + $tagids[] = $id; } return $tagids; }