diff --git a/classes/model/level.php b/classes/model/level.php index e9658ec..79eeada 100644 --- a/classes/model/level.php +++ b/classes/model/level.php @@ -128,11 +128,17 @@ public function get_random_question(): \question_definition { // build query for moodle question selection $sql = " - SELECT q.id - FROM {question} q - INNER JOIN {qtype_multichoice_options} qmo ON q.id=qmo.questionid - WHERE q.qtype = ? AND qmo.single = ? AND q.category $cat_sql - "; + SELECT q.id + FROM {question} q + INNER JOIN {qtype_multichoice_options} qmo ON q.id=qmo.questionid + JOIN {question_versions} qv ON qv.questionid = q.id + JOIN {question_bank_entries} qbe ON qv.questionbankentryid = qbe.id + JOIN {question_categories} qc ON qc.id = qbe.questioncategoryid + WHERE (qv.version = (SELECT MAX(v.version) + FROM {question_versions} v + JOIN {question_bank_entries} be ON be.id = v.questionbankentryid + WHERE be.id = qbe.id)) + AND q.qtype = ? AND qmo.single = ? AND qc.id $cat_sql "; $params = \array_merge(["multichoice", 1], $cat_params); // Get all available questions. diff --git a/version.php b/version.php index 063df51..bcf1c76 100755 --- a/version.php +++ b/version.php @@ -28,7 +28,7 @@ defined('MOODLE_INTERNAL') || die(); $plugin->component = 'mod_millionaire'; -$plugin->requires = 2017111302; +$plugin->requires = 2022041900; //requires at least Moodle 4.0! $plugin->maturity = MATURITY_BETA; -$plugin->version = 2020040301; -$plugin->release = '0.3.16'; +$plugin->version = 2023011200; +$plugin->release = '0.3.17';