Skip to content

Commit

Permalink
Merge pull request #30 from hutnikau/fix/case_insensitive_response_pr…
Browse files Browse the repository at this point in the history
…ocessing_master

Do not owerwrite `$var` variable
  • Loading branch information
Jérôme Bogaerts committed Apr 8, 2016
2 parents 71ed15a + 50f3948 commit 2af4072
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 2af4072

Please sign in to comment.