]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-7925 - it happened again. Stupid bloodly forms lib. I have no idea what it was...
authortjhunt <tjhunt>
Fri, 20 Jul 2007 17:10:35 +0000 (17:10 +0000)
committertjhunt <tjhunt>
Fri, 20 Jul 2007 17:10:35 +0000 (17:10 +0000)
question/type/description/questiontype.php
question/type/multichoice/db/upgrade.php
question/type/multichoice/version.php

index e9fc79c5dffe5fef9a2045440009bea7e056a091..7244bf86988416905d4c21fc4fcd2725931a3a9b 100644 (file)
@@ -24,6 +24,13 @@ class description_qtype extends default_questiontype {
         return false;
     }
 
+    function save_question($question, $form, $course) {
+        // Make very sure that descriptions can'e be created with a grade of
+        // anything other than 0.
+        $form->defaultgrade = 0;
+        return parent::save_question($question, $form, $course);
+    }
+
     function get_question_options(&$question) {
         // No options to be restored for this question type
         return true;
index 87157f3cc349052289b1bebafcf174bc0e8f3c79..722b9d4e4f8440658e5004b4edd2112955d3044a 100644 (file)
@@ -43,6 +43,17 @@ function xmldb_qtype_multichoice_upgrade($oldversion=0) {
         $result = $result && add_field($table, $field);
     }
 
+    // This upgrade actually belongs to the description question type,
+    // but that does not have a DB upgrade script. Therefore, multichoice
+    // is doing it.
+    // The need for this is that for a while, descriptions were being created
+    // with a defaultgrade of 1, when it shoud be 0. We need to reset them all to 0.
+    // This is re-occurrence of MDL-7925, so we need to do it again. 
+    if ($result && $oldversion < 2007072000) {
+        $result = set_field('question', 'defaultgrade', 0,
+                'qtype', DESCRIPTION, 'defaultgrade', 1);
+    }
+
     return $result;
 }
 
index 8ef7fd364d85fb08132381fda445b8bd0a6a0fb9..1d2c643da2163a099bccb96fb9d211d85e638dd9 100644 (file)
@@ -1,6 +1,6 @@
 <?PHP // $Id$
 
-$plugin->version  = 2007041300;
+$plugin->version  = 2007072000;
 $plugin->requires = 2006032200;
 
 ?>