fixed overtime calc issue
Some checks failed
Arbeitszeitmessung Deploy / Build Document Creator (push) Successful in 2m30s
Tests / Run Go Tests (push) Failing after 2m35s
Arbeitszeitmessung Deploy / Build Webserver (push) Successful in 3m19s

This commit is contained in:
2026-01-05 00:39:00 +01:00
parent b2af48463c
commit 4ded8632e5
4 changed files with 12 additions and 8 deletions

View File

@@ -28,7 +28,7 @@ func (c *CompoundDay) GetWorkDay() WorkDay {
// IsEmpty implements [IWorkDay].
func (c *CompoundDay) IsEmpty() bool {
return len(c.DayParts) > 0
return len(c.DayParts) == 0
}
// Date implements [IWorkDay].
@@ -47,12 +47,16 @@ func (c *CompoundDay) GetDayProgress(u User) int8 {
// GetOvertime implements [IWorkDay].
func (c *CompoundDay) GetOvertime(u User, base WorktimeBase, includeKurzarbeit bool) time.Duration {
work := c.GetWorktime(u, base, includeKurzarbeit)
var targetHours time.Duration
var overtime time.Duration
for _, day := range c.DayParts {
overtime += day.GetOvertime(u, base, includeKurzarbeit)
switch base {
case WorktimeBaseDay:
targetHours = u.ArbeitszeitProTagFrac(1)
case WorktimeBaseWeek:
targetHours = u.ArbeitszeitProWocheFrac(.2)
}
return overtime
return (work - targetHours).Round(time.Minute)
}
// GetPausetime implements [IWorkDay].