Skip to content

Commit

Permalink
#72 [TimeSpent] fix: time spent on non-worked days is no more counted
Browse files Browse the repository at this point in the history
  • Loading branch information
Théo David committed Nov 9, 2022
1 parent f61ca29 commit 47d359b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/dolisirh_function.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -375,11 +375,10 @@ function loadTimeSpentWithinRange($datestart, $dateend, $isavailable, $userid =
$hours = floor($timeSpentSingle->timespent_duration / 3600);
$minutes = floor($timeSpentSingle->timespent_duration / 60);

$timeSpent['hours'] += $hours;
$timeSpent['minutes'] += $minutes;
$timeSpent['total'] += $timeSpentSingle->timespent_duration;

if ($isavailable[$timeSpentSingle->timespent_date]) {
if ($isavailable[$timeSpentSingle->timespent_date]['morning'] && $isavailable[$timeSpentSingle->timespent_date]['afternoon']) {
$timeSpent['hours'] += $hours;
$timeSpent['minutes'] += $minutes;
$timeSpent['total'] += $timeSpentSingle->timespent_duration;
$days_worked[$timeSpentSingle->timespent_date] = 1;
}
}
Expand Down

0 comments on commit 47d359b

Please sign in to comment.