MDL-8177 - Random questions selected deleted questions. Backported from MOODLE_18_STABLE.
This commit is contained in:
@@ -45,6 +45,7 @@ class random_qtype extends default_questiontype {
|
||||
// 1. All questions that are explicitly assigned to the quiz
|
||||
// 2. All random questions
|
||||
// 3. All questions that are already chosen by an other random question
|
||||
// 4. Deleted questions
|
||||
if (!isset($cmoptions->questionsinuse)) {
|
||||
$cmoptions->questionsinuse = $attempt->layout;
|
||||
}
|
||||
@@ -59,14 +60,14 @@ class random_qtype extends default_questiontype {
|
||||
} else {
|
||||
$categorylist = $question->category;
|
||||
}
|
||||
if ($catrandoms = get_records_sql
|
||||
("SELECT id,id FROM {$CFG->prefix}question
|
||||
WHERE category IN ($categorylist)
|
||||
if ($catrandoms = get_records_select('question',
|
||||
"category IN ($categorylist)
|
||||
AND parent = '0'
|
||||
AND hidden = '0'
|
||||
AND id NOT IN ($cmoptions->questionsinuse)
|
||||
AND qtype NOT IN ($QTYPE_EXCLUDE_FROM_RANDOM)")) {
|
||||
AND qtype NOT IN ($QTYPE_EXCLUDE_FROM_RANDOM)", '', 'id')) {
|
||||
$this->catrandoms[$question->category][$question->questiontext] =
|
||||
draw_rand_array($catrandoms, count($catrandoms)); // from bug 1889
|
||||
draw_rand_array($catrandoms, count($catrandoms));
|
||||
} else {
|
||||
$this->catrandoms[$question->category][$question->questiontext] = array();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user