Skip to content

Commit 29b98f3

Browse files
author
David Tahir
committed
allow mutliple repItems for one goal in each interval
1 parent 2aceddd commit 29b98f3

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/Controller/AjaxController.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,19 +1243,18 @@ public function getGoals(){
12431243
}
12441244
$workedSecondsCurrentPeriod = 0;
12451245
$debtSeconds = 0;
1246-
array_pop($intervals);
12471246
foreach($intervals as $interval){
12481247
$workedInInterval = 0;
12491248
foreach($repItems as $repItem) {
12501249

12511250
if ($goal->interval == 'Weekly'){
12521251
if ($interval == $this->getStartOfWeek($repItem->time)->format('Y-m-d')) {
1253-
$workedInInterval = $repItem->totalDuration;
1252+
$workedInInterval += $repItem->totalDuration;
12541253
break;
12551254
}
12561255
} elseif ($goal->interval == 'Monthly'){
12571256
if ($interval == $this->getStartOfMonth($repItem->time)->format('Y-m')) {
1258-
$workedInInterval = $repItem->totalDuration;
1257+
$workedInInterval += $repItem->totalDuration;
12591258
break;
12601259
}
12611260
}

0 commit comments

Comments
 (0)