Exemplo n.º 1
0
 private function getPointForObjectives(Activity $activity)
 {
     $points = 0;
     $round = $activity->getRound();
     $objectiveDoneCount = count($activity->getObjectivesDone());
     $objectivesDoableCount = count($round->getObjectives());
     $points += round(300 / $objectivesDoableCount) * $objectiveDoneCount;
     if ($objectiveDoneCount === $objectivesDoableCount) {
         $timePoints = floor(1 / $activity->getDuration() * 3000);
         $activity->setTimePoints($timePoints);
         $this->em->persist($activity);
         $this->em->flush();
         $points += $timePoints;
     }
     return $points;
 }