Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix #147
  • Loading branch information
David Tahir committed Dec 11, 2021
commit 46d3199eb8105c82f88a23daa9c786413e625644
20 changes: 14 additions & 6 deletions lib/Controller/AjaxController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1245,18 +1245,26 @@ public function getGoals(){
foreach($intervals as $interval){
$workedInInterval = 0;
foreach($repItems as $repItem) {
if ($interval == $repItem->time) {
$workedInInterval = $repItem->totalDuration;
break;
}

if ($goal->interval == 'Weekly'){
if ($interval == $this->getStartOfWeek($repItem->time)->format('Y-m-d')) {
$workedInInterval = $repItem->totalDuration;
break;
}
} elseif ($goal->interval == 'Monthly'){
if ($interval == $this->getStartOfMonth($repItem->time)->format('Y-m')) {
$workedInInterval = $repItem->totalDuration;
break;
}
}
}
$debtSeconds += ($goal->hours*3600 - $workedInInterval);
}

foreach($repItems as $period){
if ($goal->interval == 'Weekly' && $period->time == $weekStart){
if ($goal->interval == 'Weekly' && $this->getStartOfWeek($period->time)->format('Y-m-d') == $weekStart){
$workedSecondsCurrentPeriod += $period->totalDuration;
} elseif ($goal->interval == 'Monthly' && $period->time == $monthStart){
} elseif ($goal->interval == 'Monthly' && $this->getStartOfMonth($period->time)->format('Y-m') == $monthStart){
$workedSecondsCurrentPeriod += $period->totalDuration;
}
}
Expand Down