Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
bheyser committed Aug 21, 2015
1 parent 5810d11 commit 41d1301
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Modules/Test/classes/class.ilTestOutputGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,9 @@ protected function redirectQuestionCmd()
if( $this->testSequence->hasOptionalQuestions() )
{
$this->adoptUserSolutionsFromPreviousPass();

$this->testSequence->reorderOptionalQuestionsToSequenceEnd();
$this->testSequence->saveToDb();
}
}

Expand Down
19 changes: 19 additions & 0 deletions Modules/Test/classes/class.ilTestSequence.php
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,25 @@ public function clearOptionalQuestions()
{
$this->optionalQuestions = array();
}

public function reorderOptionalQuestionsToSequenceEnd()
{
$optionalSequenceKeys = array();

foreach($this->sequencedata['sequence'] as $index => $sequenceKey)
{
if( $this->isQuestionOptional($this->getQuestionForSequence($sequenceKey)) )
{
$optionalSequenceKeys[$index] = $sequenceKey;
unset($this->sequencedata['sequence'][$index]);
}
}

foreach($optionalSequenceKeys as $index => $sequenceKey)
{
$this->sequencedata['sequence'][$index] = $sequenceKey;
}
}
}

?>

0 comments on commit 41d1301

Please sign in to comment.