public function getQuestionStats(Question $question, $participants)
 {
     $complete = array();
     foreach ($question->getAnswers() as $answer) {
         $trueCount = 0;
         $falseCount = 0;
         foreach ($participants as $participant) {
             foreach ($participant->getAnswers() as $participantAnswer) {
                 // Do not count opinion in stats.
                 if ($participantAnswer->getOpinion() != null) {
                     continue;
                 }
                 if ($participantAnswer->getAnswer()->getId() == $answer->getId()) {
                     if ($participantAnswer->getChecked() == true) {
                         $trueCount++;
                     } else {
                         $falseCount++;
                     }
                     if ($question->getType() == 'SINGLE') {
                         break;
                     }
                 }
             }
         }
         array_push($complete, new AnswerStat($trueCount, $falseCount, $answer->getContent()));
     }
     return $complete;
 }
 public function checkCount(Question $question)
 {
     $answers = $question->getAnswers();
     $countTrueAnswers = 0;
     foreach ($answers as $item) {
         $item->getCorrectly() ? $countTrueAnswers++ : null;
     }
     if ($countTrueAnswers > 3) {
         $this->session->getFlashBag()->add('notice', 'You have to add not more than 3 true answers for question ' . $question->getTextQuestion());
         return false;
     }
     return true;
 }