mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
Fix problem with multichoice question grading. Merged from MOODLE_17_STABLE.
This commit is contained in:
parent
f6bde593c7
commit
ef95c65ed1
1 changed files with 9 additions and 5 deletions
|
@ -339,15 +339,19 @@ class question_multichoice_qtype extends default_questiontype {
|
|||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue