Skip to content
Browse files

Fix problem with multichoice question grading.

  • Loading branch information...
1 parent 2620831 commit 3e1a16bbbcdf8ab5842f28810006c7eb02a44568 tjhunt committed Oct 19, 2006
Showing with 9 additions and 5 deletions.
  1. +9 −5 question/type/multichoice/questiontype.php
View
14 question/type/multichoice/questiontype.php
@@ -339,15 +339,19 @@ function print_question_formulation_and_controls(&$question, &$state, $cmoptions
include("$CFG->dirroot/question/type/multichoice/display.html");
}
-
-
function grade_responses(&$question, &$state, $cmoptions) {
if($question->options->single) {
- $state->raw_grade = $question->options->answers[reset($state->responses)]->fraction;
+ $response = reset($state->responses);
+ if ($response) {
+ $state->raw_grade = $question->options->answers[$response]->fraction;
+ } else {
+ $state->raw_grade = 0;
+ }
} else {
- $state->raw_grade = 0;
foreach ($state->responses as $response) {
- $state->raw_grade += $question->options->answers[$response]->fraction;
+ if ($response) {
+ $state->raw_grade += $question->options->answers[$response]->fraction;
+ }
}
}

0 comments on commit 3e1a16b

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