added pagination to working time widget (#1418)

This commit is contained in:
Kevin Papst
2020-01-30 21:51:27 +01:00
committed by GitHub
parent f2c6d8aee1
commit 9e2fccb105
9 changed files with 302 additions and 72 deletions

View File

@@ -431,20 +431,20 @@ class TimesheetRepository extends EntityRepository
*/
public function getDailyStats(User $user, DateTime $begin, DateTime $end): array
{
$results = $this->getDailyData($begin, $end, $user);
/** @var Day[] $days */
$days = [];
// prefill the array
$tmp = clone $end;
$until = (int) $begin->format('Ymd');
while ((int) $tmp->format('Ymd') > $until) {
$tmp->modify('-1 day');
while ((int) $tmp->format('Ymd') >= $until) {
$last = clone $tmp;
$days[$last->format('Ymd')] = new Day($last, 0, 0.00);
$tmp->modify('-1 day');
}
$results = $this->getDailyData($begin, $end, $user);
foreach ($results as $statRow) {
$dateTime = new DateTime();
$dateTime->setDate($statRow['year'], $statRow['month'], $statRow['day']);