Skip to content
Snippets Groups Projects
Commit 373dfac9 authored by falcon's avatar falcon
Browse files

Matching gave one minus point if you didn't choose any alternatives. This have been corrected

parent 0434549e
No related branches found
No related tags found
No related merge requests found
......@@ -304,10 +304,13 @@ class MatchingResponse extends AbstractQuizQuestionResponse {
$user_answers = isset($user_answers) ? $user_answers : $this->getUserAnswers();
// to prevent warning : Invalid argument supplied for foreach()
foreach ((array)$user_answers as $key => $value) {
if ($key != $value) {
$wrong_answer++;
if ($key == $value) {
$correct_answer++;
}
else $correct_answer++;
elseif($value == 0 || $value == 'def') {}
else {
$wrong_answer++;
}
}
$score = $correct_answer - $wrong_answer;
return $score < 0 ? 0 : $score;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment