Compare commits

...

2 Commits

Author SHA1 Message Date
gitea-actions
b185accdbb chore: bump version to v0.1.80
All checks were successful
Auto Tag Develop / tag (push) Successful in 6s
Build & Push Docker Image / build (push) Successful in 26s
2026-04-08 06:47:00 +00:00
a4bda53f57 fix : split deficit weeks by weekdays count when no hours worked
Some checks failed
Auto Tag Develop / tag (push) Has been cancelled
When a week spans two months and has zero worked hours (e.g. RTT
all week), the proportional split by worked minutes gave 0 to both
months. Now falls back to splitting by weekday count.
2026-04-08 08:17:07 +02:00
2 changed files with 16 additions and 5 deletions

View File

@@ -1,2 +1,2 @@
parameters:
app.version: '0.1.79'
app.version: '0.1.80'

View File

@@ -294,17 +294,28 @@ final readonly class EmployeeRttSummaryProvider implements ProviderInterface
}
// Week spans two months — split proportionally by daily worked minutes
$monthMinutes = [];
$monthMinutes = [];
$monthWeekdays = [];
foreach ($detail->dailyMinutes as $date => $mins) {
$m = (int) new DateTimeImmutable($date)->format('n');
$monthMinutes[$m] = ($monthMinutes[$m] ?? 0) + $mins;
$isoDay = (int) new DateTimeImmutable($date)->format('N');
if ($isoDay < 6) {
$monthWeekdays[$m] = ($monthWeekdays[$m] ?? 0) + 1;
}
}
$totalWorked = array_sum($monthMinutes);
$totalWorked = array_sum($monthMinutes);
$totalWeekdays = array_sum($monthWeekdays);
foreach ([$startMonth, $endMonth] as $month) {
$portion = $monthMinutes[$month] ?? 0;
$ratio = $totalWorked > 0 ? $portion / $totalWorked : 0.0;
if ($totalWorked > 0) {
$ratio = ($monthMinutes[$month] ?? 0) / $totalWorked;
} elseif ($totalWeekdays > 0) {
$ratio = ($monthWeekdays[$month] ?? 0) / $totalWeekdays;
} else {
$ratio = 0.0;
}
$result[] = new EmployeeRttWeekSummary(
month: $month,