Permalink
Browse files

MDL-26324 overall feedback problem when quiz changed to being graded …

…out of 0
  • Loading branch information...
1 parent 2b37004 commit 0357171e6859097bc3737bc0127e11e5bcbe13ef @timhunt timhunt committed Mar 4, 2011
Showing with 14 additions and 5 deletions.
  1. +14 −5 mod/quiz/mod_form.php
View
@@ -344,17 +344,26 @@ function data_preprocessing(&$default_values){
foreach ($this->_feedbacks as $feedback){
$draftid = file_get_submitted_draft_itemid('feedbacktext['.$key.']');
$default_values['feedbacktext['.$key.']']['text'] = file_prepare_draft_area(
- $draftid, // draftid
- $this->context->id, // context
- 'mod_quiz', // component
+ $draftid, // draftid
+ $this->context->id, // context
+ 'mod_quiz', // component
'feedback', // filarea
- !empty($feedback->id)?(int)$feedback->id:null, // itemid
+ !empty($feedback->id) ? (int) $feedback->id : null, // itemid
null,
- $feedback->feedbacktext // text
+ $feedback->feedbacktext // text
);
$default_values['feedbacktext['.$key.']']['format'] = $feedback->feedbacktextformat;
$default_values['feedbacktext['.$key.']']['itemid'] = $draftid;
+ if ($default_values['grade'] == 0) {
+ // When a quiz is un-graded, there can only be one lot of
+ // feedback. If the quiz previously had a maximum grade and
+ // several lots of feedback, we must now avoid putting text
+ // into input boxes that are disabled, but which the
+ // validation will insist are blank.
+ break;
+ }
+
if ($feedback->mingrade > 0) {
$default_values['feedbackboundaries['.$key.']'] = (100.0 * $feedback->mingrade / $default_values['grade']) . '%';
}

0 comments on commit 0357171

Please sign in to comment.