Skip to content

Commit

Permalink
Do not owerwrite variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleh Hutnikau committed Apr 8, 2016
1 parent 71ed15a commit 50f3948
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/qtism/runtime/expressions/MapResponseProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,13 @@ public function process()
for ($i = 0; $i < count($mapEntries); $i++) {

$mapKey = $rawMapKey = $mapEntries[$i]->getMapKey();

$processedVal = null;
if ($val instanceof QtiString && $mapEntries[$i]->isCaseSensitive() === false) {
$val = mb_strtolower($val->getValue(), 'UTF-8');
$processedVal = mb_strtolower($val->getValue(), 'UTF-8');
$mapKey = mb_strtolower($mapKey, 'UTF-8');
}

if (($val instanceof Comparable && $val->equals($mapKey) === true) || $val === $mapKey) {
if (($val instanceof Comparable && $val->equals($mapKey) === true) || $processedVal === $mapKey) {
if (in_array($rawMapKey, $mapped, true) === false) {
$result += $mapEntries[$i]->getMappedValue();
$mapped[] = $rawMapKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ public function testMultipleCardinalityIdentifierToFloat() {
<value>Choice7</value>
</correctResponse>
<mapping>
<mapEntry mapKey="Choice1" mappedValue="2"/>
<mapEntry mapKey="Choice6" mappedValue="20"/>
<mapEntry mapKey="Choice1" mappedValue="2" caseSensitive="false"/>
<mapEntry mapKey="Choice6" mappedValue="20" caseSensitive="false"/>
<mapEntry mapKey="Choice9" mappedValue="20"/>
<mapEntry mapKey="Choice2" mappedValue="-20"/>
<mapEntry mapKey="Choice3" mappedValue="-20"/>
Expand Down

0 comments on commit 50f3948

Please sign in to comment.