fix duration calculation for multiple entries of same activity

This commit is contained in:
Kevin Papst
2020-08-19 10:08:25 +02:00
parent 15c3acfa0b
commit ec612d1046

View File

@@ -416,7 +416,7 @@ class TimesheetRepository extends EntityRepository
$newDateBegin = clone $endTmp;
}
// make sure to exclude entries that are outside the requested timerange:
// make sure to exclude entries that are outside the requested time-range:
// these entries can exist if you have long running entries that started before $begin
// for statistical reasons we have to include everything between $begin and $end while
// excluding everything that is outside of that range
@@ -449,6 +449,7 @@ class TimesheetRepository extends EntityRepository
. '_' . $result->getProject()->getId()
. '_' . $result->getActivity()->getId()
;
if (!isset($results[$dateKey]['details'][$detailsId])) {
$results[$dateKey]['details'][$detailsId] = [
'project' => $result->getProject(),
@@ -456,10 +457,10 @@ class TimesheetRepository extends EntityRepository
'duration' => 0,
'rate' => 0,
];
$results[$dateKey]['details'][$detailsId]['duration'] += $duration;
$results[$dateKey]['details'][$detailsId]['rate'] += $rate;
}
$results[$dateKey]['details'][$detailsId]['duration'] += $duration;
$results[$dateKey]['details'][$detailsId]['rate'] += $rate;
}
$beginTmp = $newDateBegin;