fix: wrong kurzarbeit calculation fixed #80
Some checks failed
Tests / Run Go Tests (push) Failing after 1m5s
Some checks failed
Tests / Run Go Tests (push) Failing after 1m5s
This commit is contained in:
@@ -31,6 +31,7 @@ type WorkWeek struct {
|
||||
Overtime time.Duration
|
||||
Status WeekStatus
|
||||
WeekBase WorktimeBase
|
||||
Kurzarbeit time.Duration
|
||||
}
|
||||
|
||||
type WeekStatus int8
|
||||
@@ -72,8 +73,13 @@ func (w *WorkWeek) PopulateWithDays(worktime time.Duration, overtime time.Durati
|
||||
}
|
||||
|
||||
for _, day := range w.Days {
|
||||
w.Worktime += day.GetWorktime(w.User, w.WeekBase, false)
|
||||
w.WorktimeVirtual += day.GetWorktime(w.User, w.WeekBase, true)
|
||||
dWorkTime := day.GetWorktime(w.User, w.WeekBase, false)
|
||||
dWorkTimeVirtual := day.GetWorktime(w.User, w.WeekBase, true)
|
||||
if dWorkTime < dWorkTimeVirtual {
|
||||
w.Kurzarbeit += dWorkTimeVirtual - dWorkTime
|
||||
}
|
||||
w.Worktime += dWorkTime
|
||||
w.WorktimeVirtual += dWorkTimeVirtual
|
||||
slog.Debug("Calculated Worktime", "Day", day.ToString(), "worktime", w.Worktime.String())
|
||||
}
|
||||
slog.Debug("Got worktime for user", "worktime", w.Worktime.String(), "virtualWorkTime", w.WorktimeVirtual.String())
|
||||
|
||||
Reference in New Issue
Block a user