Permalink
Browse files

Merge branch 'MDL-34702_22' of git://github.com/timhunt/moodle into M…

…OODLE_22_STABLE
  • Loading branch information...
2 parents 4263e87 + 7fbbcdb commit 407c0fbcd619d68c3ed511538811f529334cc8ba @stronk7 stronk7 committed Aug 22, 2012
Showing with 22 additions and 3 deletions.
  1. +1 −1 mod/quiz/backup/moodle1/lib.php
  2. +1 −1 mod/quiz/db/install.xml
  3. +19 −0 mod/quiz/db/upgrade.php
  4. +1 −1 mod/quiz/version.php
View
2 mod/quiz/backup/moodle1/lib.php
@@ -57,7 +57,7 @@ public function get_paths() {
array(
'newfields' => array(
'showuserpicture' => 0,
- 'questiondecimalpoints' => -2,
+ 'questiondecimalpoints' => -1,
'introformat' => 0,
'showblocks' => 0,
)
View
2 mod/quiz/db/install.xml
@@ -18,7 +18,7 @@
<FIELD NAME="attemptonlast" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" PREVIOUS="attempts" NEXT="grademethod"/>
<FIELD NAME="grademethod" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="false" DEFAULT="1" SEQUENCE="false" PREVIOUS="attemptonlast" NEXT="decimalpoints"/>
<FIELD NAME="decimalpoints" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="false" DEFAULT="2" SEQUENCE="false" PREVIOUS="grademethod" NEXT="questiondecimalpoints"/>
- <FIELD NAME="questiondecimalpoints" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="false" DEFAULT="-2" SEQUENCE="false" PREVIOUS="decimalpoints" NEXT="reviewattempt"/>
+ <FIELD NAME="questiondecimalpoints" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="false" DEFAULT="-1" SEQUENCE="false" PREVIOUS="decimalpoints" NEXT="reviewattempt"/>
<FIELD NAME="reviewattempt" TYPE="int" LENGTH="6" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="Whether users are allowed to review their quiz attempts at various times. This is a bit field, decoded by the mod_quiz_display_options class. It is formed by ORing together the constants defined there." PREVIOUS="questiondecimalpoints" NEXT="reviewcorrectness"/>
<FIELD NAME="reviewcorrectness" TYPE="int" LENGTH="6" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="Whether users are allowed to review their quiz attempts at various times. A bit field, like reviewattempt." PREVIOUS="reviewattempt" NEXT="reviewmarks"/>
<FIELD NAME="reviewmarks" TYPE="int" LENGTH="6" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="Whether users are allowed to review their quiz attempts at various times. A bit field, like reviewattempt." PREVIOUS="reviewcorrectness" NEXT="reviewspecificfeedback"/>
View
19 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;
}
View
2 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;

0 comments on commit 407c0fb

Please sign in to comment.