File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -1245,18 +1245,26 @@ public function getGoals(){
12451245 foreach ($ intervals as $ interval ){
12461246 $ workedInInterval = 0 ;
12471247 foreach ($ repItems as $ repItem ) {
1248- if ($ interval == $ repItem ->time ) {
1249- $ workedInInterval = $ repItem ->totalDuration ;
1250- break ;
1251- }
1248+
1249+ if ($ goal ->interval == 'Weekly ' ){
1250+ if ($ interval == $ this ->getStartOfWeek ($ repItem ->time )->format ('Y-m-d ' )) {
1251+ $ workedInInterval = $ repItem ->totalDuration ;
1252+ break ;
1253+ }
1254+ } elseif ($ goal ->interval == 'Monthly ' ){
1255+ if ($ interval == $ this ->getStartOfMonth ($ repItem ->time )->format ('Y-m ' )) {
1256+ $ workedInInterval = $ repItem ->totalDuration ;
1257+ break ;
1258+ }
1259+ }
12521260 }
12531261 $ debtSeconds += ($ goal ->hours *3600 - $ workedInInterval );
12541262 }
12551263
12561264 foreach ($ repItems as $ period ){
1257- if ($ goal ->interval == 'Weekly ' && $ period ->time == $ weekStart ){
1265+ if ($ goal ->interval == 'Weekly ' && $ this -> getStartOfWeek ( $ period ->time )-> format ( ' Y-m-d ' ) == $ weekStart ){
12581266 $ workedSecondsCurrentPeriod += $ period ->totalDuration ;
1259- } elseif ($ goal ->interval == 'Monthly ' && $ period ->time == $ monthStart ){
1267+ } elseif ($ goal ->interval == 'Monthly ' && $ this -> getStartOfMonth ( $ period ->time )-> format ( ' Y-m ' ) == $ monthStart ){
12601268 $ workedSecondsCurrentPeriod += $ period ->totalDuration ;
12611269 }
12621270 }
You can’t perform that action at this time.
0 commit comments