From 2a42f0383218803cf17b1867106990391d87f063 Mon Sep 17 00:00:00 2001 From: Gordon Bateson Date: Tue, 29 Mar 2016 16:36:55 +0900 Subject: [PATCH] MDL-79863 qtype_ordering: qtype_ordering force standard settings for Ordering questions used by Reader quizzes --- question/type/ordering/db/upgrade.php | 10 +++++++--- question/type/ordering/version.php | 4 ++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/question/type/ordering/db/upgrade.php b/question/type/ordering/db/upgrade.php index 708bef7ecda..ea3bd56f486 100644 --- a/question/type/ordering/db/upgrade.php +++ b/question/type/ordering/db/upgrade.php @@ -185,7 +185,7 @@ function xmldb_qtype_ordering_upgrade($oldversion) { upgrade_plugin_savepoint(true, $newversion, 'qtype', 'ordering'); } - $newversion = 2016032947; + $newversion = 2016032949; if ($oldversion < $newversion) { if ($dbman->table_exists('reader_question_instances')) { $select = 'rqi.question, COUNT(*) AS countquestion'; @@ -202,8 +202,12 @@ function xmldb_qtype_ordering_upgrade($oldversion) { $DB->set_field_select($table, 'layouttype', 0, $select, $params); // VERTICAL $DB->set_field_select($table, 'selecttype', 1, $select, $params); // RANDOM $DB->set_field_select($table, 'gradingtype', 1, $select, $params); // RELATIVE - // Note don't set selectcount to 6, because - // Ordering questions for some low level books use 4 + + // for selectcount, we only fix the value, if it is zero (=ALL) + // because Ordering questions for some low level books use 4 + $select .= ' AND selectcount = ?'; + $params[] = 0; + $DB->set_field_select($table, 'selectcount', 6, $select, $params); // 6 } } } diff --git a/question/type/ordering/version.php b/question/type/ordering/version.php index 3cbf69da89c..7414811d230 100644 --- a/question/type/ordering/version.php +++ b/question/type/ordering/version.php @@ -31,5 +31,5 @@ $plugin->cron = 0; $plugin->component = 'qtype_ordering'; $plugin->maturity = MATURITY_STABLE; $plugin->requires = 2010112400; // Moodle 2.0 -$plugin->version = 2016032948; -$plugin->release = '2016-03-29 (48)'; +$plugin->version = 2016032949; +$plugin->release = '2016-03-29 (49)';