diff --git a/mod/quiz/backup/moodle1/lib.php b/mod/quiz/backup/moodle1/lib.php
index 2e25b40a77c..09efca0df64 100644
--- a/mod/quiz/backup/moodle1/lib.php
+++ b/mod/quiz/backup/moodle1/lib.php
@@ -56,7 +56,7 @@ class moodle1_mod_quiz_handler extends moodle1_mod_handler {
array(
'newfields' => array(
'showuserpicture' => 0,
- 'questiondecimalpoints' => -2,
+ 'questiondecimalpoints' => -1,
'introformat' => 0,
'showblocks' => 0,
)
diff --git a/mod/quiz/db/install.xml b/mod/quiz/db/install.xml
index fd12420079c..dede549feda 100644
--- a/mod/quiz/db/install.xml
+++ b/mod/quiz/db/install.xml
@@ -21,7 +21,7 @@
-
+
diff --git a/mod/quiz/db/upgrade.php b/mod/quiz/db/upgrade.php
index 3bbbb6d4d83..cb8e76df0a9 100644
--- a/mod/quiz/db/upgrade.php
+++ b/mod/quiz/db/upgrade.php
@@ -341,6 +341,25 @@ function xmldb_quiz_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2012061702, 'quiz');
}
+ if ($oldversion < 2012061703) {
+
+ // MDL-34702 the questiondecimalpoints column was created with default -2
+ // when it should have been -1, and no-one has noticed in the last 2+ years!
+
+ // Changing the default of field questiondecimalpoints on table quiz to -1.
+ $table = new xmldb_table('quiz');
+ $field = new xmldb_field('questiondecimalpoints', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, '-1', 'decimalpoints');
+
+ // Launch change of default for field questiondecimalpoints.
+ $dbman->change_field_default($table, $field);
+
+ // Correct any wrong values.
+ $DB->set_field('quiz', 'questiondecimalpoints', -1, array('questiondecimalpoints' => -2));
+
+ // Quiz savepoint reached.
+ upgrade_mod_savepoint(true, 2012061703, 'quiz');
+ }
+
return true;
}
diff --git a/mod/quiz/version.php b/mod/quiz/version.php
index 67ca371213d..59c7b3c332d 100644
--- a/mod/quiz/version.php
+++ b/mod/quiz/version.php
@@ -25,7 +25,7 @@
defined('MOODLE_INTERNAL') || die();
-$module->version = 2012061702; // The current module version (Date: YYYYMMDDXX).
+$module->version = 2012061703; // The current module version (Date: YYYYMMDDXX).
$module->requires = 2012061700; // Requires this Moodle version.
$module->component = 'mod_quiz'; // Full name of the plugin (used for diagnostics).
$module->cron = 60;