Skip to content

Commit

Permalink
Merge branch 'MDL-30033_21' of git://github.com/timhunt/moodle into M…
Browse files Browse the repository at this point in the history
…OODLE_21_STABLE
  • Loading branch information
stronk7 committed Jan 23, 2012
2 parents e06a172 + 1ee150e commit b5c2f10
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mod/quiz/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,10 @@ function quiz_feedback_for_grade($grade, $quiz, $context) {
return '';
}

// With CBM etc, it is possible to get -ve grades, which would then not match
// any feedback. Therefore, we replace -ve grades with 0.
$grade = max($grade, 0);

$feedback = $DB->get_record_select('quiz_feedback',
'quizid = ? AND mingrade <= ? AND ? < maxgrade', array($quiz->id, $grade, $grade));

Expand Down
4 changes: 4 additions & 0 deletions mod/quiz/report/reportlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,10 @@ function quiz_report_feedback_for_grade($grade, $quizid, $context) {
$feedbackcache[$quizid] = $DB->get_records('quiz_feedback', array('quizid' => $quizid));
}

// With CBM etc, it is possible to get -ve grades, which would then not match
// any feedback. Therefore, we replace -ve grades with 0.
$grade = max($grade, 0);

$feedbacks = $feedbackcache[$quizid];
$feedbackid = 0;
$feedbacktext = '';
Expand Down

0 comments on commit b5c2f10

Please sign in to comment.