/** * @param $activityTypeConstant * @return WeekStats */ public static function getUsualDaysOff($activityTypeConstant) { $stats = new WeekStats(); foreach (self::$daysOfWeekOff[$activityTypeConstant] as $dayOff) { $stats->setTotalDay($dayOff, 1); } return $stats; }
/** * @covers ::__construct * @covers ::setTotalDay * @covers ::getTotalSunday */ public function testEnsureHelperTotalSundayCorrectlyReturned() { $stats = new WeekStats(); $stats->setTotalDay(Day::WEEK_SUNDAY, 5); $this->assertEquals(5, $stats->getTotalSunday()); }
/** * @param $options * @return WeekStats */ public function getWeekMeals($options) { $dates = $this->getWeekDates($options); $statsLunch = new WeekStats(); foreach ($dates['days'] as $day) { // compte le nombre d'élèves inscrits à la cantine // qui ne sont pas : // en sortie scolaire ce jour là // inscrits en voyage scolaire (non annulé) ce jour là $query = $this->createQueryBuilder('l')->select('COUNT(l)')->join('l.eleve', 'e')->where('DATE(l.date) = :date_day')->andWhere('e.regimeSansPorc = :pork')->setParameter(':date_day', $day->format('Y-m-d'))->setParameter(':pork', $options['without_pork']); $query = $this->excludePupilsTravellingAt($query, 'e', $day); $totalCurrentDay = $query->getQuery()->getSingleScalarResult(); $statsLunch->setTotalDay(Day::getWeekDayFrom($day), $totalCurrentDay); } return $statsLunch; }