Skip to content

Commit

Permalink
MDL-26324 overall feedback problem when quiz changed to being graded …
Browse files Browse the repository at this point in the history
…out of 0
  • Loading branch information
timhunt committed Mar 4, 2011
1 parent 2b37004 commit 0357171
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions mod/quiz/mod_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']) . '%';
}
Expand Down

0 comments on commit 0357171

Please sign in to comment.