Skip to content
Snippets Groups Projects
Commit 22544152 authored by Elmar Ludwig's avatar Elmar Ludwig
Browse files

fix evaluation in edge case for mco_exercise, fixes #115

parent c4c2e8b0
No related branches found
No related tags found
No related merge requests found
...@@ -122,7 +122,7 @@ class mco_exercise extends Exercise ...@@ -122,7 +122,7 @@ class mco_exercise extends Exercise
if ($response[$i] == '-1') { if ($response[$i] == '-1') {
$points = NULL; $points = NULL;
} else { } else {
$points = $response[$i] == $answer['choice'] ? 1 : 0; $points = $response[$i] == (string) $answer['choice'] ? 1 : 0;
} }
$result[] = ['points' => $points, 'safe' => true]; $result[] = ['points' => $points, 'safe' => true];
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<td style="white-space: nowrap;"> <td style="white-space: nowrap;">
<? if ($solution->id): ?> <? if ($solution->id): ?>
<? if ($response[$key] == $entry['choice']): ?> <? if ($response[$key] == (string) $entry['choice']): ?>
<?= Icon::create('accept', 'status-green', ['class' => 'correction_marker', 'title' => _vips('richtig')]) ?> <?= Icon::create('accept', 'status-green', ['class' => 'correction_marker', 'title' => _vips('richtig')]) ?>
<? elseif ($response[$key] != -1): ?> <? elseif ($response[$key] != -1): ?>
<?= Icon::create('decline', 'status-red', ['class' => 'correction_marker', 'title' => _vips('falsch')]) ?> <?= Icon::create('decline', 'status-red', ['class' => 'correction_marker', 'title' => _vips('falsch')]) ?>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment