diff --git a/mod/quiz/backup/moodle1/lib.php b/mod/quiz/backup/moodle1/lib.php
index 4f43ef225a4..828755648ae 100644
--- a/mod/quiz/backup/moodle1/lib.php
+++ b/mod/quiz/backup/moodle1/lib.php
@@ -57,7 +57,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 934c92fc209..1da9689ca6e 100644
--- a/mod/quiz/db/install.xml
+++ b/mod/quiz/db/install.xml
@@ -18,7 +18,7 @@
-
+
diff --git a/mod/quiz/db/upgrade.php b/mod/quiz/db/upgrade.php
index 2e53c05bd24..72616ed3844 100644
--- a/mod/quiz/db/upgrade.php
+++ b/mod/quiz/db/upgrade.php
@@ -1207,6 +1207,25 @@ function xmldb_quiz_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2011112903, 'quiz');
}
+ if ($oldversion < 2011112904) {
+
+ // 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 eaa16f44626..50ca87f4e1e 100644
--- a/mod/quiz/version.php
+++ b/mod/quiz/version.php
@@ -25,7 +25,7 @@
defined('MOODLE_INTERNAL') || die();
-$module->version = 2011112903; // The current module version (Date: YYYYMMDDXX)
+$module->version = 2011112904; // The current module version (Date: YYYYMMDDXX)
$module->requires = 2011112900; // Requires this Moodle version
$module->component = 'mod_quiz'; // Full name of the plugin (used for diagnostics)
$module->cron = 60;