From 41d3730951fa9f1f4af93c1dd8961598eeaa6f22 Mon Sep 17 00:00:00 2001 From: tjhunt Date: Mon, 10 Nov 2008 07:56:37 +0000 Subject: [PATCH] random questions: MDL-17185 regression from MDL-17160 random questions were no longer randomising. Backporting Jamie's fix to 1.9, and making a minor improvement along the way. --- question/type/random/questiontype.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/question/type/random/questiontype.php b/question/type/random/questiontype.php index db693ab01b..a7c979604e 100644 --- a/question/type/random/questiontype.php +++ b/question/type/random/questiontype.php @@ -95,7 +95,6 @@ class random_qtype extends default_questiontype { AND qtype NOT IN ($QTYPE_EXCLUDE_FROM_RANDOM)", null, '', 'id')) { $catrandoms = array(); } - $catrandoms = swapshuffle_assoc($catrandoms); return $catrandoms; } @@ -113,9 +112,9 @@ class random_qtype extends default_questiontype { } if (!isset($this->catrandoms[$question->category][$question->questiontext])) { - $this->catrandoms[$question->category][$question->questiontext] = - $this->get_usable_questions_from_category($question->category, + $catrandoms = $this->get_usable_questions_from_category($question->category, $question->questiontext == "1", $cmoptions->questionsinuse); + $this->catrandoms[$question->category][$question->questiontext] = swapshuffle_assoc($catrandoms); } while ($wrappedquestion = array_pop( -- 2.39.5