Skip to content

Commit

Permalink
Merge pull request #6 from Learnosity/test-mapper-support
Browse files Browse the repository at this point in the history
	Add more tests and fix few bugs and update latest qti version
  • Loading branch information
stellalie authored Aug 10, 2016
2 parents 1a18f89 + 7e1fc79 commit 758d08f
Show file tree
Hide file tree
Showing 14 changed files with 259 additions and 136 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"symfony/dependency-injection": "v2.6.8",
"jms/aop-bundle": "1.0.1",
"jms/di-extra-bundle": "1.5.0",
"qtism/qtism": "3.2.3"
"qtism/qtism": "4.2.0"
},
"require-dev": {
"phpunit/phpunit": "4.8.4"
Expand Down
113 changes: 57 additions & 56 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 10 additions & 4 deletions src/Processors/QtiV2/In/Interactions/MatchInteractionMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function getQuestionType()
$uiStyle = new choicematrix_ui_style();
$uiStyle->set_type('table');

$isMultipleResponse = $this->isMultipleResponse($interaction->getTargetChoices());
$isMultipleResponse = $this->isMultipleResponse($interaction);
$question = new choicematrix('choicematrix', $options, $stems);
$question->set_multiple_responses($isMultipleResponse);
$question->set_stimulus($this->getPrompt());
Expand All @@ -55,11 +55,17 @@ public function getQuestionType()
return $question;
}

private function isMultipleResponse(SimpleMatchSet $targetChoices)
private function isMultipleResponse(QtiMatchInteraction $interaction)
{
// We determine whether the question shall be mapped to `multiple_responses` as true
// if any the target choices (options) can be mapped to be more than 1
foreach ($targetChoices->getSimpleAssociableChoices() as $choice) {
// if any the source choices (stems or options) can be mapped to be more than 1
foreach ($interaction->getSourceChoices()->getSimpleAssociableChoices() as $choice) {
/** @var SimpleAssociableChoice $choice */
if ($choice->getMatchMax() !== 1) {
return true;
}
}
foreach ($interaction->getTargetChoices()->getSimpleAssociableChoices() as $choice) {
/** @var SimpleAssociableChoice $choice */
if ($choice->getMatchMax() !== 1) {
return true;
Expand Down
Loading

0 comments on commit 758d08f

Please sign in to comment.