Skip to content
Browse files

Merge branch 'MDL-26324' of git://github.com/timhunt/moodle

  • Loading branch information...
2 parents 34e30d9 + 0357171 commit 5ff33ba14bf8c5be29092274aa5ea6768dc89b6f @stronk7 stronk7 committed Mar 7, 2011
Showing with 14 additions and 5 deletions.
  1. +14 −5 mod/quiz/mod_form.php
View
19 mod/quiz/mod_form.php
@@ -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 5ff33ba

Please sign in to comment.
Something went wrong with that request. Please try again.