From 828df720a25189fea0b8b30d126309778da67321 Mon Sep 17 00:00:00 2001 From: tjhunt Date: Fri, 15 Dec 2006 15:41:56 +0000 Subject: [PATCH] MDL-7925 - description question types were being created with defaultgrade = 1. It should be zero, so fix the bug, and reset any wrong ones in the database. Merged from MOODLE_17_STABLE. --- question/type/description/editquestion.html | 3 +++ question/type/multichoice/db/upgrade.php | 18 ++++++++++-------- question/type/multichoice/version.php | 2 +- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/question/type/description/editquestion.html b/question/type/description/editquestion.html index 4bd53b1c72..45b0f3c84e 100644 --- a/question/type/description/editquestion.html +++ b/question/type/description/editquestion.html @@ -1,5 +1,8 @@ qtype]->print_question_form_start($question, array(), $course, $usehtmleditor, array('defaultgrade', 'penalty')); +?> + +qtype]->print_question_form_end($question); ?> diff --git a/question/type/multichoice/db/upgrade.php b/question/type/multichoice/db/upgrade.php index 020d78976b..46015de1e7 100644 --- a/question/type/multichoice/db/upgrade.php +++ b/question/type/multichoice/db/upgrade.php @@ -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; } diff --git a/question/type/multichoice/version.php b/question/type/multichoice/version.php index e6e6337095..e708d3dffc 100644 --- a/question/type/multichoice/version.php +++ b/question/type/multichoice/version.php @@ -1,6 +1,6 @@ version = 2006081900; +$plugin->version = 2006121500; $plugin->requires = 2006032200; ?> -- 2.39.5