]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-7925 - description question types were being created with defaultgrade = 1. It...
authortjhunt <tjhunt>
Fri, 15 Dec 2006 15:41:56 +0000 (15:41 +0000)
committertjhunt <tjhunt>
Fri, 15 Dec 2006 15:41:56 +0000 (15:41 +0000)
question/type/description/editquestion.html
question/type/multichoice/db/upgrade.php
question/type/multichoice/version.php

index 4bd53b1c7245708bc4d9a9b775085bcf47bf51c2..45b0f3c84e0774ecb0b00107b1bb880bc734f42b 100644 (file)
@@ -1,5 +1,8 @@
 <?php
 $QTYPES[$question->qtype]->print_question_form_start($question, array(), $course, $usehtmleditor,
         array('defaultgrade', 'penalty'));
+?>
+      <input type="hidden" name="defaultgrade" value="0" />
+<?php
 $QTYPES[$question->qtype]->print_question_form_end($question);
 ?>
index 020d78976b4d7b6b788f86758619fa89220831ff..46015de1e79ee03b8013969f431709822bb958d0 100644 (file)
@@ -23,14 +23,16 @@ function xmldb_qtype_multichoice_upgrade($oldversion=0) {
 
     $result = true;
 
-/// And upgrade begins here. For each one, you'll need one 
-/// block of code similar to the next one. Please, delete 
-/// this comment lines once this file start handling proper
-/// upgrade code.
-
-/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
-///     $result = result of "/lib/ddllib.php" function calls
-/// }
+    // 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.
+    // See MDL-7925. 
+    if ($result && $oldversion < 2006121500) {
+        $result = set_field('question', 'defaultgrade', 0,
+                'qtype', DESCRIPTION, 'defaultgrade', 1);
+    }
 
     return $result;
 }
index e6e6337095a09c70590cfe24a0ea259bfa94f392..e708d3dffc5fef75e6882f44b8fc5da6120e23b7 100644 (file)
@@ -1,6 +1,6 @@
 <?PHP // $Id$
 
-$plugin->version  = 2006081900;
+$plugin->version  = 2006121500;
 $plugin->requires = 2006032200;
 
 ?>