MDL-26848 get rid of stupid unsigned columns in the quiz statistics report.
authorTim Hunt <T.J.Hunt@open.ac.uk>
Thu, 17 Mar 2011 10:38:51 +0000 (10:38 +0000)
committerTim Hunt <T.J.Hunt@open.ac.uk>
Thu, 17 Mar 2011 12:48:01 +0000 (12:48 +0000)
mod/quiz/report/statistics/db/install.xml
mod/quiz/report/statistics/db/upgrade.php
mod/quiz/report/statistics/version.php

index 700023a..b44b0eb 100644 (file)
         <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" PREVIOUS="allattempts" NEXT="firstattemptscount"/>
         <FIELD NAME="firstattemptscount" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" PREVIOUS="timemodified" NEXT="allattemptscount"/>
         <FIELD NAME="allattemptscount" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" PREVIOUS="firstattemptscount" NEXT="firstattemptsavg"/>
-        <FIELD NAME="firstattemptsavg" TYPE="number" LENGTH="15" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" DECIMALS="5" PREVIOUS="allattemptscount" NEXT="allattemptsavg"/>
-        <FIELD NAME="allattemptsavg" TYPE="number" LENGTH="15" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" DECIMALS="5" PREVIOUS="firstattemptsavg" NEXT="median"/>
-        <FIELD NAME="median" TYPE="number" LENGTH="15" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" DECIMALS="5" PREVIOUS="allattemptsavg" NEXT="standarddeviation"/>
-        <FIELD NAME="standarddeviation" TYPE="number" LENGTH="15" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" DECIMALS="5" PREVIOUS="median" NEXT="skewness"/>
+        <FIELD NAME="firstattemptsavg" TYPE="number" LENGTH="15" NOTNULL="false" UNSIGNED="false" SEQUENCE="false" DECIMALS="5" PREVIOUS="allattemptscount" NEXT="allattemptsavg"/>
+        <FIELD NAME="allattemptsavg" TYPE="number" LENGTH="15" NOTNULL="false" UNSIGNED="false" SEQUENCE="false" DECIMALS="5" PREVIOUS="firstattemptsavg" NEXT="median"/>
+        <FIELD NAME="median" TYPE="number" LENGTH="15" NOTNULL="false" UNSIGNED="false" SEQUENCE="false" DECIMALS="5" PREVIOUS="allattemptsavg" NEXT="standarddeviation"/>
+        <FIELD NAME="standarddeviation" TYPE="number" LENGTH="15" NOTNULL="false" UNSIGNED="false" SEQUENCE="false" DECIMALS="5" PREVIOUS="median" NEXT="skewness"/>
         <FIELD NAME="skewness" TYPE="number" LENGTH="15" NOTNULL="false" UNSIGNED="false" SEQUENCE="false" DECIMALS="10" PREVIOUS="standarddeviation" NEXT="kurtosis"/>
         <FIELD NAME="kurtosis" TYPE="number" LENGTH="15" NOTNULL="false" UNSIGNED="false" SEQUENCE="false" DECIMALS="5" PREVIOUS="skewness" NEXT="cic"/>
         <FIELD NAME="cic" TYPE="number" LENGTH="15" NOTNULL="false" UNSIGNED="false" SEQUENCE="false" DECIMALS="10" PREVIOUS="kurtosis" NEXT="errorratio"/>
-        <FIELD NAME="errorratio" TYPE="number" LENGTH="15" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" DECIMALS="10" PREVIOUS="cic" NEXT="standarderror"/>
-        <FIELD NAME="standarderror" TYPE="number" LENGTH="15" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" DECIMALS="10" PREVIOUS="errorratio"/>
+        <FIELD NAME="errorratio" TYPE="number" LENGTH="15" NOTNULL="false" UNSIGNED="false" SEQUENCE="false" DECIMALS="10" PREVIOUS="cic" NEXT="standarderror"/>
+        <FIELD NAME="standarderror" TYPE="number" LENGTH="15" NOTNULL="false" UNSIGNED="false" SEQUENCE="false" DECIMALS="10" PREVIOUS="errorratio"/>
       </FIELDS>
       <KEYS>
         <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
         <FIELD NAME="questionid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" PREVIOUS="quizstatisticsid" NEXT="subquestion"/>
         <FIELD NAME="subquestion" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" PREVIOUS="questionid" NEXT="s"/>
         <FIELD NAME="s" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="subquestion" NEXT="effectiveweight"/>
-        <FIELD NAME="effectiveweight" TYPE="number" LENGTH="15" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" DECIMALS="5" PREVIOUS="s" NEXT="negcovar"/>
+        <FIELD NAME="effectiveweight" TYPE="number" LENGTH="15" NOTNULL="false" UNSIGNED="false" SEQUENCE="false" DECIMALS="5" PREVIOUS="s" NEXT="negcovar"/>
         <FIELD NAME="negcovar" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="effectiveweight" NEXT="discriminationindex"/>
         <FIELD NAME="discriminationindex" TYPE="number" LENGTH="15" NOTNULL="false" UNSIGNED="false" SEQUENCE="false" DECIMALS="5" PREVIOUS="negcovar" NEXT="discriminativeefficiency"/>
         <FIELD NAME="discriminativeefficiency" TYPE="number" LENGTH="15" NOTNULL="false" UNSIGNED="false" SEQUENCE="false" DECIMALS="5" PREVIOUS="discriminationindex" NEXT="sd"/>
-        <FIELD NAME="sd" TYPE="number" LENGTH="15" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" DECIMALS="10" PREVIOUS="discriminativeefficiency" NEXT="facility"/>
-        <FIELD NAME="facility" TYPE="number" LENGTH="15" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" DECIMALS="10" PREVIOUS="sd" NEXT="subquestions"/>
+        <FIELD NAME="sd" TYPE="number" LENGTH="15" NOTNULL="false" UNSIGNED="false" SEQUENCE="false" DECIMALS="10" PREVIOUS="discriminativeefficiency" NEXT="facility"/>
+        <FIELD NAME="facility" TYPE="number" LENGTH="15" NOTNULL="false" UNSIGNED="false" SEQUENCE="false" DECIMALS="10" PREVIOUS="sd" NEXT="subquestions"/>
         <FIELD NAME="subquestions" TYPE="text" LENGTH="medium" NOTNULL="false" SEQUENCE="false" PREVIOUS="facility" NEXT="maxgrade"/>
-        <FIELD NAME="maxgrade" TYPE="number" LENGTH="12" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" DECIMALS="7" PREVIOUS="subquestions" NEXT="positions"/>
+        <FIELD NAME="maxgrade" TYPE="number" LENGTH="12" NOTNULL="false" UNSIGNED="false" SEQUENCE="false" DECIMALS="7" PREVIOUS="subquestions" NEXT="positions"/>
         <FIELD NAME="positions" TYPE="text" LENGTH="medium" NOTNULL="false" SEQUENCE="false" COMMENT="positions in which this item appears. Only used for random questions." PREVIOUS="maxgrade"/>
       </FIELDS>
       <KEYS>
@@ -57,7 +57,7 @@
         <FIELD NAME="aid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" 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" UNSIGNED="true" SEQUENCE="false" PREVIOUS="response" NEXT="credit"/>
-        <FIELD NAME="credit" TYPE="number" LENGTH="15" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" DECIMALS="5" PREVIOUS="rcount"/>
+        <FIELD NAME="credit" TYPE="number" LENGTH="15" NOTNULL="true" UNSIGNED="false" SEQUENCE="false" DECIMALS="5" PREVIOUS="rcount"/>
       </FIELDS>
       <KEYS>
         <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
index 0d6795d..f4e4764 100644 (file)
@@ -160,6 +160,74 @@ function xmldb_quiz_statistics_upgrade($oldversion) {
         upgrade_plugin_savepoint(true, 2008112100, 'quizreport', 'statistics');
     }
 
+    if ($oldversion < 2008112101) {
+        // Removed stupid UNSIGNED from all NUMBER columns in the quiz_statistics table.
+        $table = new xmldb_table('quiz_statistics');
+
+        // Change of sign for field firstattemptsavg
+        $field = new xmldb_field('firstattemptsavg', XMLDB_TYPE_NUMBER, '15, 5', null, null, null, null, 'allattemptscount');
+        $dbman->change_field_unsigned($table, $field);
+
+        // Change of sign for field allattemptsavg
+        $field = new xmldb_field('allattemptsavg', XMLDB_TYPE_NUMBER, '15, 5', null, null, null, null, 'firstattemptsavg');
+        $dbman->change_field_unsigned($table, $field);
+
+                // Change of sign for field median
+        $field = new xmldb_field('median', XMLDB_TYPE_NUMBER, '15, 5', null, null, null, null, 'allattemptsavg');
+        $dbman->change_field_unsigned($table, $field);
+
+                // Change of sign for field standarddeviation
+        $field = new xmldb_field('standarddeviation', XMLDB_TYPE_NUMBER, '15, 5', null, null, null, null, 'median');
+        $dbman->change_field_unsigned($table, $field);
+
+                // Change of sign for field errorratio
+        $field = new xmldb_field('errorratio', XMLDB_TYPE_NUMBER, '15, 10', null, null, null, null, 'cic');
+        $dbman->change_field_unsigned($table, $field);
+
+                // Change of sign for field standarderror
+        $field = new xmldb_field('standarderror', XMLDB_TYPE_NUMBER, '15, 10', null, null, null, null, 'errorratio');
+        $dbman->change_field_unsigned($table, $field);
+
+        // statistics savepoint reached
+        upgrade_plugin_savepoint(true, 2008112101, 'quiz', 'statistics');
+    }
+
+    if ($oldversion < 2008112102) {
+        // Removed stupid UNSIGNED from all NUMBER columns in the quiz_question_statistics table.
+        $table = new xmldb_table('quiz_question_statistics');
+
+        // Change of sign for field effectiveweight
+        $field = new xmldb_field('effectiveweight', XMLDB_TYPE_NUMBER, '15, 5', null, null, null, null, 's');
+        $dbman->change_field_unsigned($table, $field);
+
+        // Change of sign for field sd
+        $field = new xmldb_field('sd', XMLDB_TYPE_NUMBER, '15, 10', null, null, null, null, 'discriminativeefficiency');
+        $dbman->change_field_unsigned($table, $field);
+
+                // Change of sign for field facility
+        $field = new xmldb_field('facility', XMLDB_TYPE_NUMBER, '15, 10', null, null, null, null, 'sd');
+        $dbman->change_field_unsigned($table, $field);
+
+                // Change of sign for field maxgrade
+        $field = new xmldb_field('maxgrade', XMLDB_TYPE_NUMBER, '12, 7', null, null, null, null, 'subquestions');
+        $dbman->change_field_unsigned($table, $field);
+
+        // statistics savepoint reached
+        upgrade_plugin_savepoint(true, 2008112102, 'quiz', 'statistics');
+    }
+
+    if ($oldversion < 2008112103) {
+        // Removed stupid UNSIGNED from all NUMBER columns in the quiz_question_response_stats table.
+        $table = new xmldb_table('quiz_question_response_stats');
+
+        // Change of sign for field credit
+        $field = new xmldb_field('credit', XMLDB_TYPE_NUMBER, '15, 5', null, null, null, null, 'rcount');
+        $dbman->change_field_unsigned($table, $field);
+
+        // statistics savepoint reached
+        upgrade_plugin_savepoint(true, 2008112103, 'quiz', 'statistics');
+    }
+
     return true;
 }
 
index 8d23da5..464cbbe 100644 (file)
@@ -1,2 +1,2 @@
 <?php
-$plugin->version  = 2008112100;   // The (date) version of this module
+$plugin->version  = 2008112103;   // The (date) version of this module