]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-7308 - Check all the DB columns used to store grades, and make sure they all...
authortjhunt <tjhunt>
Fri, 15 Aug 2008 11:15:08 +0000 (11:15 +0000)
committertjhunt <tjhunt>
Fri, 15 Aug 2008 11:15:08 +0000 (11:15 +0000)
12 files changed:
lib/db/install.xml
lib/db/upgrade.php
mod/quiz/db/install.xml
mod/quiz/db/upgrade.php
mod/quiz/report/statistics/db/install.xml
mod/quiz/report/statistics/db/upgrade.php
mod/quiz/report/statistics/version.php
mod/quiz/version.php
mod/quiz/view.php
question/type/questiontype.php
question/type/shortanswer/questiontype.php
version.php

index 61bf12a08d123dae612dc2010ee4f55414a07cef..55417de27c8a6063cbba2e3d08c1da502fa08141 100644 (file)
         <FIELD NAME="questiontextformat" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="questiontext" NEXT="image"/>
         <FIELD NAME="image" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="questiontextformat" NEXT="generalfeedback"/>
         <FIELD NAME="generalfeedback" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" COMMENT="to store the question feedback" PREVIOUS="image" NEXT="defaultgrade"/>
-        <FIELD NAME="defaultgrade" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="1" SEQUENCE="false" ENUM="false" PREVIOUS="generalfeedback" NEXT="penalty"/>
-        <FIELD NAME="penalty" TYPE="float" NOTNULL="true" UNSIGNED="false" DEFAULT="0.1" SEQUENCE="false" ENUM="false" PREVIOUS="defaultgrade" NEXT="qtype"/>
+        <FIELD NAME="defaultgrade" TYPE="number" LENGTH="12" NOTNULL="true" UNSIGNED="true" DEFAULT="1" SEQUENCE="false" ENUM="false" DECIMALS="7" PREVIOUS="generalfeedback" NEXT="penalty"/>
+        <FIELD NAME="penalty" TYPE="number" LENGTH="12" NOTNULL="true" UNSIGNED="false" DEFAULT="0.1" SEQUENCE="false" ENUM="false" DECIMALS="7" PREVIOUS="defaultgrade" NEXT="qtype"/>
         <FIELD NAME="qtype" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="penalty" NEXT="length"/>
         <FIELD NAME="length" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="1" SEQUENCE="false" ENUM="false" PREVIOUS="qtype" NEXT="stamp"/>
         <FIELD NAME="stamp" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="length" NEXT="version"/>
         <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="question"/>
         <FIELD NAME="question" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="answer"/>
         <FIELD NAME="answer" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="question" NEXT="fraction"/>
-        <FIELD NAME="fraction" TYPE="float" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="answer" NEXT="feedback"/>
+        <FIELD NAME="fraction" TYPE="number" LENGTH="12" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" DECIMALS="7" PREVIOUS="answer" NEXT="feedback"/>
         <FIELD NAME="feedback" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="fraction"/>
       </FIELDS>
       <KEYS>
         <FIELD NAME="answer" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="seq_number" NEXT="timestamp"/>
         <FIELD NAME="timestamp" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="answer" NEXT="event"/>
         <FIELD NAME="event" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="timestamp" NEXT="grade"/>
-        <FIELD NAME="grade" TYPE="float" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="event" NEXT="raw_grade"/>
-        <FIELD NAME="raw_grade" TYPE="float" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="grade" NEXT="penalty"/>
-        <FIELD NAME="penalty" TYPE="float" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="raw_grade"/>
+        <FIELD NAME="grade" TYPE="number" LENGTH="12" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" DECIMALS="7" PREVIOUS="event" NEXT="raw_grade"/>
+        <FIELD NAME="raw_grade" TYPE="number" LENGTH="12" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" DECIMALS="7" PREVIOUS="grade" NEXT="penalty"/>
+        <FIELD NAME="penalty" TYPE="number" LENGTH="12" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" DECIMALS="7" PREVIOUS="raw_grade"/>
       </FIELDS>
       <KEYS>
         <KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="attempt"/>
         <FIELD NAME="questionid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="attemptid" NEXT="newest"/>
         <FIELD NAME="newest" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="questionid" NEXT="newgraded"/>
         <FIELD NAME="newgraded" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="newest" NEXT="sumpenalty"/>
-        <FIELD NAME="sumpenalty" TYPE="float" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="newgraded" NEXT="manualcomment"/>
+        <FIELD NAME="sumpenalty" TYPE="number" LENGTH="12" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" DECIMALS="7" PREVIOUS="newgraded" NEXT="manualcomment"/>
         <FIELD NAME="manualcomment" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="sumpenalty"/>
       </FIELDS>
       <KEYS>
index 1c59600ea52ae62809c09322f74e15b5e0a4fa77..9994486abf32cea087a6635be9e616ad3170b4fd 100644 (file)
@@ -617,6 +617,56 @@ function xmldb_main_upgrade($oldversion=0) {
         upgrade_main_savepoint($result, 2008080701);
     }
 
+/// Changing the type of all the columns that the question bank uses to store grades to be NUMBER(12, 7).
+    if ($result && $oldversion < 2008081500) {
+        $table = new xmldb_table('question');
+        $field = new xmldb_field('defaultgrade', XMLDB_TYPE_NUMBER, '12, 7', null, null, null, null, null, null, 'generalfeedback');
+        $dbman->change_field_type($table, $field);
+        upgrade_main_savepoint($result, 2008081500);
+    }
+
+    if ($result && $oldversion < 2008081501) {
+        $table = new xmldb_table('question');
+        $field = new xmldb_field('penalty', XMLDB_TYPE_NUMBER, '12, 7', null, null, null, null, null, null, 'defaultgrade');
+        $dbman->change_field_type($table, $field);
+        upgrade_main_savepoint($result, 2008081501);
+    }
+
+    if ($result && $oldversion < 2008081502) {
+        $table = new xmldb_table('question_answers');
+        $field = new xmldb_field('fraction', XMLDB_TYPE_NUMBER, '12, 7', null, null, null, null, null, null, 'answer');
+        $dbman->change_field_type($table, $field);
+        upgrade_main_savepoint($result, 2008081502);
+    }
+
+    if ($result && $oldversion < 2008081503) {
+        $table = new xmldb_table('question_sessions');
+        $field = new xmldb_field('sumpenalty', XMLDB_TYPE_NUMBER, '12, 7', null, null, null, null, null, null, 'newgraded');
+        $dbman->change_field_type($table, $field);
+        upgrade_main_savepoint($result, 2008081503);
+    }
+
+    if ($result && $oldversion < 2008081504) {
+        $table = new xmldb_table('question_states');
+        $field = new xmldb_field('grade', XMLDB_TYPE_NUMBER, '12, 7', null, null, null, null, null, null, 'event');
+        $dbman->change_field_type($table, $field);
+        upgrade_main_savepoint($result, 2008081504);
+    }
+
+    if ($result && $oldversion < 2008081505) {
+        $table = new xmldb_table('question_states');
+        $field = new xmldb_field('raw_grade', XMLDB_TYPE_NUMBER, '12, 7', null, null, null, null, null, null, 'grade');
+        $dbman->change_field_type($table, $field);
+        upgrade_main_savepoint($result, 2008081505);
+    }
+
+    if ($result && $oldversion < 2008081506) {
+        $table = new xmldb_table('question_states');
+        $field = new xmldb_field('penalty', XMLDB_TYPE_NUMBER, '12, 7', null, null, null, null, null, null, 'raw_grade');
+        $dbman->change_field_type($table, $field);
+        upgrade_main_savepoint($result, 2008081506);
+    }
+
     return $result;
 }
 
index f0f997fc885a01645f11f9bebe568c27dc38862e..a78bc5c6475663acded937a81c0d2428b64dc404 100755 (executable)
@@ -23,8 +23,8 @@
         <FIELD NAME="shufflequestions" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="questionsperpage" NEXT="shuffleanswers"/>
         <FIELD NAME="shuffleanswers" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="shufflequestions" NEXT="questions"/>
         <FIELD NAME="questions" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="shuffleanswers" NEXT="sumgrades"/>
-        <FIELD NAME="sumgrades" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="questions" NEXT="grade"/>
-        <FIELD NAME="grade" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="sumgrades" NEXT="timecreated"/>
+        <FIELD NAME="sumgrades" TYPE="number" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" DECIMALS="5" PREVIOUS="questions" NEXT="grade"/>
+        <FIELD NAME="grade" TYPE="number" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" DECIMALS="5" PREVIOUS="sumgrades" NEXT="timecreated"/>
         <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="grade" NEXT="timemodified"/>
         <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="timecreated" NEXT="timelimit"/>
         <FIELD NAME="timelimit" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="timemodified" NEXT="password"/>
@@ -48,7 +48,7 @@
         <FIELD NAME="quiz" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="uniqueid" NEXT="userid"/>
         <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="quiz" NEXT="attempt"/>
         <FIELD NAME="attempt" TYPE="int" LENGTH="6" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="userid" NEXT="sumgrades"/>
-        <FIELD NAME="sumgrades" TYPE="float" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="attempt" NEXT="timestart"/>
+        <FIELD NAME="sumgrades" TYPE="number" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" DECIMALS="5" PREVIOUS="attempt" NEXT="timestart"/>
         <FIELD NAME="timestart" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="sumgrades" NEXT="timefinish"/>
         <FIELD NAME="timefinish" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="timestart" NEXT="timemodified"/>
         <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="timefinish" NEXT="layout"/>
@@ -69,7 +69,7 @@
         <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="quiz"/>
         <FIELD NAME="quiz" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="userid"/>
         <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="quiz" NEXT="grade"/>
-        <FIELD NAME="grade" TYPE="float" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="userid" NEXT="timemodified"/>
+        <FIELD NAME="grade" TYPE="number" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" DECIMALS="5" PREVIOUS="userid" NEXT="timemodified"/>
         <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="grade"/>
       </FIELDS>
       <KEYS>
@@ -85,7 +85,7 @@
         <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="quiz"/>
         <FIELD NAME="quiz" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="question"/>
         <FIELD NAME="question" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="quiz" NEXT="grade"/>
-        <FIELD NAME="grade" TYPE="int" LENGTH="6" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="question"/>
+        <FIELD NAME="grade" TYPE="number" LENGTH="12" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" DECIMALS="7" PREVIOUS="question"/>
       </FIELDS>
       <KEYS>
         <KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="quiz"/>
         <KEY NAME="question" TYPE="foreign" FIELDS="question" REFTABLE="question" REFFIELDS="id" PREVIOUS="quiz"/>
       </KEYS>
     </TABLE>
-    <TABLE NAME="quiz_feedback" COMMENT="Feedback given to students based on their overall score on the test" PREVIOUS="quiz_grades" NEXT="quiz_report">
+    <TABLE NAME="quiz_feedback" COMMENT="Feedback given to students based on their overall score on the test" PREVIOUS="quiz_question_instances" NEXT="quiz_report">
       <FIELDS>
         <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="quizid"/>
         <FIELD NAME="quizid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="feedbacktext"/>
         <FIELD NAME="feedbacktext" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="quizid" NEXT="mingrade"/>
-        <FIELD NAME="mingrade" TYPE="float" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="feedbacktext" NEXT="maxgrade"/>
-        <FIELD NAME="maxgrade" TYPE="float" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="mingrade"/>
+        <FIELD NAME="mingrade" TYPE="number" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" DECIMALS="5" PREVIOUS="feedbacktext" NEXT="maxgrade"/>
+        <FIELD NAME="maxgrade" TYPE="number" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" DECIMALS="5" PREVIOUS="mingrade"/>
       </FIELDS>
       <KEYS>
         <KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="quizid"/>
index 8bb84736502f5a98949b29896079ec0840ba71fc..6a0b0420f730c16c83a6699acddc234ec09d637a 100644 (file)
@@ -119,6 +119,56 @@ function xmldb_quiz_upgrade($oldversion=0) {
         upgrade_mod_savepoint($result, 2008081500, 'quiz');
     }
 
+    /// Changing the type of all the columns that store grades to be NUMBER(10, 5) or similar.
+    if ($result && $oldversion < 2008081501) {
+        $table = new xmldb_table('quiz');
+        $field = new xmldb_field('sumgrades', XMLDB_TYPE_NUMBER, '10, 5', null, null, null, null, null, null, 'questions');
+        $dbman->change_field_type($table, $field);
+        upgrade_mod_savepoint($result, 2008081501, 'quiz');
+    }
+
+    if ($result && $oldversion < 2008081502) {
+        $table = new xmldb_table('quiz');
+        $field = new xmldb_field('grade', XMLDB_TYPE_NUMBER, '10, 5', null, null, null, null, null, null, 'sumgrades');
+        $dbman->change_field_type($table, $field);
+        upgrade_mod_savepoint($result, 2008081502, 'quiz');
+    }
+
+    if ($result && $oldversion < 2008081503) {
+        $table = new xmldb_table('quiz_attempts');
+        $field = new xmldb_field('sumgrades', XMLDB_TYPE_NUMBER, '10, 5', null, null, null, null, null, null, 'attempt');
+        $dbman->change_field_type($table, $field);
+        upgrade_mod_savepoint($result, 2008081503, 'quiz');
+    }
+
+    if ($result && $oldversion < 2008081504) {
+        $table = new xmldb_table('quiz_feedback');
+        $field = new xmldb_field('mingrade', XMLDB_TYPE_NUMBER, '10, 5', null, null, null, null, null, null, 'feedbacktext');
+        $dbman->change_field_type($table, $field);
+        upgrade_mod_savepoint($result, 2008081504, 'quiz');
+    }
+
+    if ($result && $oldversion < 2008081505) {
+        $table = new xmldb_table('quiz_feedback');
+        $field = new xmldb_field('maxgrade', XMLDB_TYPE_NUMBER, '10, 5', null, null, null, null, null, null, 'mingrade');
+        $dbman->change_field_type($table, $field);
+        upgrade_mod_savepoint($result, 2008081505, 'quiz');
+    }
+
+    if ($result && $oldversion < 2008081506) {
+        $table = new xmldb_table('quiz_grades');
+        $field = new xmldb_field('grade', XMLDB_TYPE_NUMBER, '10, 5', null, null, null, null, null, null, 'userid');
+        $dbman->change_field_type($table, $field);
+        upgrade_mod_savepoint($result, 2008081506, 'quiz');
+    }
+
+    if ($result && $oldversion < 2008081507) {
+        $table = new xmldb_table('quiz_question_instances');
+        $field = new xmldb_field('grade', XMLDB_TYPE_NUMBER, '12, 7', null, null, null, null, null, null, 'question');
+        $dbman->change_field_type($table, $field);
+        upgrade_mod_savepoint($result, 2008081507, 'quiz');
+    }
+
     return $result;
 }
 
index 89f61b7098e9b3142edd3b9867a124d5d7894a8e..13cb5fd3174bdd0b4e918fceee2f6a7cc1a110b5 100644 (file)
@@ -40,7 +40,7 @@
         <FIELD NAME="sd" TYPE="number" LENGTH="15" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" ENUM="false" DECIMALS="10" PREVIOUS="discriminativeefficiency" NEXT="facility"/>
         <FIELD NAME="facility" TYPE="number" LENGTH="15" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" ENUM="false" DECIMALS="10" PREVIOUS="sd" NEXT="subquestions"/>
         <FIELD NAME="subquestions" TYPE="text" LENGTH="medium" NOTNULL="false" SEQUENCE="false" ENUM="false" PREVIOUS="facility" NEXT="maxgrade"/>
-        <FIELD NAME="maxgrade" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="subquestions" NEXT="positions"/>
+        <FIELD NAME="maxgrade" TYPE="number" LENGTH="12" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" ENUM="false" DECIMALS="7" PREVIOUS="subquestions" NEXT="positions"/>
         <FIELD NAME="positions" TYPE="text" LENGTH="medium" NOTNULL="false" SEQUENCE="false" ENUM="false" COMMENT="positions in which this item appears. Only used for random questions." PREVIOUS="maxgrade"/>
       </FIELDS>
       <KEYS>
index 10489e9b656d80c0e89eb22dd1fe93c395580a60..e8e007870fb1c67d48d92aaa0e3d0fc9acf46133 100644 (file)
@@ -51,7 +51,16 @@ function xmldb_quizreport_statistics_upgrade($oldversion=0) {
         }
 
     }
-    
+
+    if ($result && $oldversion < 2008081500) {
+    /// Changing type of field maxgrade on table quiz_question_statistics to number
+        $table = new xmldb_table('quiz_question_statistics');
+        $field = new xmldb_field('maxgrade', XMLDB_TYPE_NUMBER, '12, 7', null, null, null, null, null, null, 'subquestions');
+
+    /// Launch change of type for field maxgrade
+        $dbman->change_field_type($table, $field);
+    }
+
     return $result;
 }
 
index 406f977934a812f07c921222d81d6eb7afb68673..4e37fd381a958e1a73fc9eaa5d0acc5f5ea19706 100644 (file)
@@ -1,4 +1,4 @@
 <?php
-$plugin->version  = 2008072801;   // The (date) version of this module
+$plugin->version  = 2008081500;   // The (date) version of this module
 
 ?>
\ No newline at end of file
index a65c89176bd993b26fe08a950a0e351af7e33e0c..5d214239f9721d6127b5fe3b794a05e91e807292 100644 (file)
@@ -5,7 +5,7 @@
 //  This fragment is called by moodle_needs_upgrading() and /admin/index.php
 ////////////////////////////////////////////////////////////////////////////////
 
-$module->version  = 2008081500;   // The (date) version of this module
+$module->version  = 2008081507;   // The (date) version of this module
 $module->requires = 2008072401;   // Requires this Moodle version
 $module->cron     = 0;            // How often should cron check this module (seconds)?
 
index 5a6aeb7ceb65b0816855392879ad309ecf8f8f0b..ad1147f758c1cf80110d5e00218f2171fc2bd8e1 100644 (file)
         $table->align = array('center', 'left');
         $table->size = array('', '');
         if ($markcolumn) {
-            $table->head[] = get_string('marks', 'quiz') . " / $quiz->sumgrades";
+            $table->head[] = get_string('marks', 'quiz') . ' / ' . quiz_format_grade($quiz, $quiz->sumgrades);
             $table->align[] = 'center';
             $table->size[] = '';
         }
         if ($gradecolumn) {
-            $table->head[] = get_string('grade') . " / $quiz->grade";
+            $table->head[] = get_string('grade') . ' / ' . quiz_format_grade($quiz, $quiz->grade);
             $table->align[] = 'center';
             $table->size[] = '';
         }
index 7e68c0e0e90f8854df12550500331b6414aee748..f6c627e70f1140d4b008b54130ccd080a2d9296c 100644 (file)
@@ -861,7 +861,7 @@ class default_questiontype {
                     $grade = '--/'; 
                 }
             }
-            $grade .= $question->maxgrade;
+            $grade .= question_format_grade($cmoptions, $question->maxgrade);
         }
 
         $comment = $state->manualcomment;
@@ -993,7 +993,7 @@ class default_questiontype {
                 // Display the grading details from the last graded state
                 $grade = new stdClass;
                 $grade->cur = question_format_grade($cmoptions, $state->last_graded->grade);
-                $grade->max = $question->maxgrade;
+                $grade->max = question_format_grade($cmoptions, $question->maxgrade);
                 $grade->raw = question_format_grade($cmoptions, $state->last_graded->raw_grade);
 
                 // let student know wether the answer was correct
@@ -1018,7 +1018,7 @@ class default_questiontype {
                         if ('' !== $state->last_graded->penalty && ((float)$state->last_graded->penalty) > 0.0) {
                             // A penalty was applied so display it
                             echo ' ';
-                            print_string('gradingdetailspenalty', 'quiz', $state->last_graded->penalty);
+                            print_string('gradingdetailspenalty', 'quiz', question_format_grade($cmoptions, $state->last_graded->penalty));
                         } else {
                             /* No penalty was applied even though the answer was
                             not correct (eg. a syntax error) so tell the student
index 5e700df4c9c3f821242e7fa283df78f0d8981497..3322cd8e30a3c3361274bb8865f93341b2972af6 100644 (file)
@@ -401,7 +401,7 @@ class question_shortanswer_qtype extends default_questiontype {
                 // Display the grading details from the last graded state
                 $grade = new stdClass;
                 $grade->cur = question_format_grade($cmoptions, $state->last_graded->grade);
-                $grade->max = $question->maxgrade;
+                $grade->max = question_format_grade($cmoptions, $question->maxgrade);
                 $grade->raw = question_format_grade($cmoptions, $state->last_graded->raw_grade);
 
                 // let student know wether the answer was correct
index 7ec204b03e8bda4468ca6f3da9145360cd9f28aa..75731f35bf5aacff759d2753fbe418c1b4b37f7c 100644 (file)
@@ -6,7 +6,7 @@
 // This is compared against the values stored in the database to determine
 // whether upgrades should be performed (see lib/db/*.php)
 
-    $version = 2008081200;  // YYYYMMDD   = date of the last version bump
+    $version = 2008081506;  // YYYYMMDD   = date of the last version bump
                             //         XX = daily increments
 
     $release = '2.0 dev (Build: 20080815)';  // Human-friendly version name