]> git.mjollnir.org Git - moodle.git/commitdiff
quiz overview report: Fix type of the grade columns to be NUMBER(12,7).
authortjhunt <tjhunt>
Thu, 5 Mar 2009 11:24:15 +0000 (11:24 +0000)
committertjhunt <tjhunt>
Thu, 5 Mar 2009 11:24:15 +0000 (11:24 +0000)
Also, improve comments.

mod/quiz/report/overview/db/install.xml
mod/quiz/report/overview/db/upgrade.php
mod/quiz/report/overview/version.php

index e19ca9635264905ba285a3b2daa17bcb0edc853a..c79f217a1a83e2e80c8bbc0de7c9f8b789045ede 100644 (file)
@@ -1,18 +1,18 @@
 <?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="mod/quiz/report/overview/db" VERSION="20080711" COMMENT="XMLDB file for Moodle mod/quiz/report/overview"
+<XMLDB PATH="mod/quiz/report/overview/db" VERSION="20090305" COMMENT="XMLDB file for Moodle mod/quiz/report/overview"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:noNamespaceSchemaLocation="../../../../../lib/xmldb/xmldb.xsd"
 >
   <TABLES>
-    <TABLE NAME="quiz_question_regrade" COMMENT="table to record which question attempts need regrading and the grade they will be regraded to.">
+    <TABLE NAME="quiz_question_regrade" COMMENT="This table records which question attempts need regrading and the grade they will be regraded to.">
       <FIELDS>
         <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="questionid"/>
-        <FIELD NAME="questionid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="attemptid"/>
-        <FIELD NAME="attemptid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="questionid" NEXT="newgrade"/>
-        <FIELD NAME="newgrade" TYPE="number" LENGTH="10" NOTNULL="true" UNSIGNED="false" SEQUENCE="false" ENUM="false" DECIMALS="5" PREVIOUS="attemptid" NEXT="oldgrade"/>
-        <FIELD NAME="oldgrade" TYPE="number" LENGTH="10" NOTNULL="true" UNSIGNED="false" SEQUENCE="false" ENUM="false" DECIMALS="5" PREVIOUS="newgrade" NEXT="regraded"/>
+        <FIELD NAME="questionid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" COMMENT="Foreign key references question.id." PREVIOUS="id" NEXT="attemptid"/>
+        <FIELD NAME="attemptid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" COMMENT="Foreign key references question_attempt.id, or equivalently quiz_attempt.uniqueid." PREVIOUS="questionid" NEXT="newgrade"/>
+        <FIELD NAME="newgrade" TYPE="number" LENGTH="12" NOTNULL="true" UNSIGNED="false" SEQUENCE="false" ENUM="false" DECIMALS="7" COMMENT="The new grade for this question after regrading." PREVIOUS="attemptid" NEXT="oldgrade"/>
+        <FIELD NAME="oldgrade" TYPE="number" LENGTH="12" NOTNULL="true" UNSIGNED="false" SEQUENCE="false" ENUM="false" DECIMALS="7" COMMENT="The previous grade for this question in this attempt." PREVIOUS="newgrade" NEXT="regraded"/>
         <FIELD NAME="regraded" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" COMMENT="set to 0 if element has just been regraded. Set to 1 if element has been marked as needing regrading." PREVIOUS="oldgrade" NEXT="timemodified"/>
-        <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="regraded"/>
+        <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" COMMENT="Timestamp of when this row was last modified." PREVIOUS="regraded"/>
       </FIELDS>
       <KEYS>
         <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
index 57ae3a93b9eb143ea3cdbf7ac35bf5f55a981ee1..ae692d5aaf1fc196fed635f54d35793f7d6856ca 100644 (file)
@@ -22,7 +22,6 @@ function xmldb_quizreport_overview_upgrade($oldversion) {
         $table->add_field('regraded', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null);
         $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null);
 
-
     /// Adding keys to table quiz_question_regrade
         $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
 
@@ -32,7 +31,22 @@ function xmldb_quizreport_overview_upgrade($oldversion) {
         }
     }
 
+    if ($result && $oldversion < 2009030500) {
+    /// Changing precision of field newgrade on table quiz_question_regrade to (12, 7).
+        $table = new xmldb_table('quiz_question_regrade');
+        $field = new xmldb_field('newgrade', XMLDB_TYPE_NUMBER, '12, 7', null, XMLDB_NOTNULL, null, null, null, null, 'attemptid');
+
+    /// Launch change of precision for field newgrade
+        $dbman->change_field_precision($table, $field);
 
+    /// Changing precision of field oldgrade on table quiz_question_regrade to (12, 7).
+        $table = new xmldb_table('quiz_question_regrade');
+        $field = new xmldb_field('oldgrade', XMLDB_TYPE_NUMBER, '12, 7', null, XMLDB_NOTNULL, null, null, null, null, 'newgrade');
+
+    /// Launch change of precision for field newgrade
+        $dbman->change_field_precision($table, $field);
+    }
+    
     return $result;
 }
 
index a69690d619b6f752955b42d77dcd9929cc1b792e..e17349bd3a4b0c029689e40f6926cd16b4e2d690 100644 (file)
@@ -5,6 +5,6 @@
 //  This fragment is called by moodle_needs_upgrading() and /admin/index.php
 ////////////////////////////////////////////////////////////////////////////////
 
-$plugin->version  = 2008062700;   // The (date) version of this module
+$plugin->version  = 2009030500;   // The (date) version of this module
 
 ?>