MDL-33778 quiz statistics: part and class ids can be strings, not just ints.
authorTim Hunt <T.J.Hunt@open.ac.uk>
Fri, 15 Jun 2012 12:53:02 +0000 (13:53 +0100)
committerTim Hunt <T.J.Hunt@open.ac.uk>
Mon, 18 Jun 2012 13:39:21 +0000 (14:39 +0100)
mod/quiz/report/statistics/db/install.xml
mod/quiz/report/statistics/db/upgrade.php
mod/quiz/report/statistics/version.php

index 7184605..9a2186e 100644 (file)
@@ -55,8 +55,8 @@
         <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" NEXT="quizstatisticsid"/>
         <FIELD NAME="quizstatisticsid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" PREVIOUS="id" NEXT="questionid"/>
         <FIELD NAME="questionid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" PREVIOUS="quizstatisticsid" NEXT="subqid"/>
-        <FIELD NAME="subqid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" PREVIOUS="questionid" NEXT="aid"/>
-        <FIELD NAME="aid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" PREVIOUS="subqid" NEXT="response"/>
+        <FIELD NAME="subqid" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false" PREVIOUS="questionid" NEXT="aid"/>
+        <FIELD NAME="aid" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false" PREVIOUS="subqid" NEXT="response"/>
         <FIELD NAME="response" TYPE="text" LENGTH="big" NOTNULL="false" SEQUENCE="false" PREVIOUS="aid" NEXT="rcount"/>
         <FIELD NAME="rcount" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" PREVIOUS="response" NEXT="credit"/>
         <FIELD NAME="credit" TYPE="number" LENGTH="15" NOTNULL="true" SEQUENCE="false" DECIMALS="5" PREVIOUS="rcount"/>
index 00f9350..f3a7871 100644 (file)
@@ -37,6 +37,32 @@ function xmldb_quiz_statistics_upgrade($oldversion) {
     // Moodle v2.2.0 release upgrade line.
     // Put any upgrade step following this.
 
+    if ($oldversion < 2012061800) {
+
+        // Changing type of field subqid on table quiz_question_response_stats to char.
+        $table = new xmldb_table('quiz_question_response_stats');
+        $field = new xmldb_field('subqid', XMLDB_TYPE_CHAR, '100', null, XMLDB_NOTNULL, null, null, 'questionid');
+
+        // Launch change of type for field subqid.
+        $dbman->change_field_type($table, $field);
+
+        // Statistics savepoint reached.
+        upgrade_plugin_savepoint(true, 2012061800, 'quiz', 'statistics');
+    }
+
+    if ($oldversion < 2012061801) {
+
+        // Changing type of field aid on table quiz_question_response_stats to char.
+        $table = new xmldb_table('quiz_question_response_stats');
+        $field = new xmldb_field('aid', XMLDB_TYPE_CHAR, '100', null, null, null, null, 'subqid');
+
+        // Launch change of type for field aid.
+        $dbman->change_field_type($table, $field);
+
+        // Statistics savepoint reached.
+        upgrade_plugin_savepoint(true, 2012061801, 'quiz', 'statistics');
+    }
+
     return true;
 }
 
index 1db495a..b9d77cc 100644 (file)
@@ -24,7 +24,7 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2012061700;
+$plugin->version   = 2012061801;
 $plugin->requires  = 2012061700;
 $plugin->cron      = 18000;
 $plugin->component = 'quiz_statistics';