Skip to content

Commit

Permalink
MDL-7925 - it happened again. Stupid bloodly forms lib. I have no ide…
Browse files Browse the repository at this point in the history
…a what it was playing at. Merged from MOODLE_18_STABLE.
  • Loading branch information
tjhunt committed Jul 20, 2007
1 parent c186c7b commit bfbafdf
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
7 changes: 7 additions & 0 deletions question/type/description/questiontype.php
Expand Up @@ -24,6 +24,13 @@ function is_usable_by_random() {
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;
Expand Down
11 changes: 11 additions & 0 deletions question/type/multichoice/db/upgrade.php
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion question/type/multichoice/version.php
@@ -1,6 +1,6 @@
<?PHP // $Id$

$plugin->version = 2007041300;
$plugin->version = 2007072000;
$plugin->requires = 2006032200;

?>

0 comments on commit bfbafdf

Please sign in to comment.