/**
  * @see ExerciseControllerInterface::registerAnswerAction();
  *
  * @param \_OurBrand_\Quiz\Domain\Model\Exercises\MatchSequenceExercise $exercise
  * @return void
  */
 public function registerAnswerAction($exercise)
 {
     $answers = $this->request->hasArgument('answeredPhrases') ? $this->request->getArgument('answeredPhrases') : array();
     $score = $exercise->calculateScoreForAnswers($answers);
     $status = $exercise->isCompleted($answers);
     $orderedAnswers = $this->request->hasArgument('basePhrases') ? $this->request->getArgument('basePhrases') : array();
     $identifier = $this->persistenceManager->getIdentifierByObject($exercise);
     $this->loginSession->setData('answers-' . $identifier, array_unique($orderedAnswers));
     // Save the score, for the given answers, on this exercise, during this quiz.
     $this->exerciseService->registerAnswer($score, $status, $answers, $exercise, $this->studentQuizSession);
     $this->studentQuizSessionService->updateProgress($this->studentQuizSession);
     $this->view->assign('value', array('timeRemaining' => $this->studentQuizSession->getTimeRemaining()));
     if (!$this->isJson) {
         $this->redirect('studentnavigate', 'quiz', $this->request->hasArgument('goto') ? $this->request->getArgument('goto') : 'next');
     }
 }
 /**
  * @dataProvider totalDataProvider
  * @param array $data
  * @param integer $isReadyForCompletion
  * @param integer $maxScore
  */
 public function testReadyFroCompetitionAndMaxScoreAndGetData($data, $isReadyForCompletion, $maxScore)
 {
     $exercise = new MatchSequenceExercise();
     $exercise->setPhrasesFromArray($data);
     $exercise->setDescription('sdfdsfds');
     $exercise->setTitle('dfgdfgfd');
     $this->assertSame($isReadyForCompletion, $exercise->getReadyForCompletion());
     $this->assertSame($maxScore, $exercise->getMaxScore());
 }