tried to add untertags krank
Some checks failed
Tests / Run Go Tests (push) Failing after 2m3s

This commit is contained in:
2025-12-05 15:03:34 +01:00
parent a6ea625e8f
commit f73c2b1a96
21 changed files with 508 additions and 653 deletions

View File

@@ -47,18 +47,20 @@ func NewWorkWeek(user User, tsMonday time.Time, populate bool) WorkWeek {
}
func (w *WorkWeek) PopulateWithDays(worktime time.Duration, overtime time.Duration) {
slog.Debug("Populating Workweek for user", "user", w.User)
slog.Debug("Got Days with overtime and worktime", slog.String("worktime", worktime.String()), slog.String("overtime", overtime.String()))
w.Days = GetDays(w.User, w.WeekStart, w.WeekStart.Add(6*24*time.Hour), false)
for _, day := range w.Days {
work, _ := day.TimePauseReal(w.User)
w.Worktime += work
w.WorkTimeVirtual += day.TimeWorkVirtual(w.User)
w.Worktime += day.GetWorktimeReal(w.User, WorktimeBaseDay)
w.WorkTimeVirtual += day.GetWorktimeVirtual(w.User, WorktimeBaseDay)
}
slog.Debug("Got worktime for user", "user", w.User, "worktime", w.Worktime.String(), "virtualWorkTime", w.WorkTimeVirtual.String())
slog.Debug("Got worktime for user", "worktime", w.Worktime.String(), "virtualWorkTime", w.WorkTimeVirtual.String())
w.Overtime = w.WorkTimeVirtual - w.User.ArbeitszeitProWoche()
slog.Debug("Calculated overtime", "worktime", w.Worktime.String(), "virtualWorkTime", w.WorkTimeVirtual.String())
w.Worktime = w.Worktime.Round(time.Minute)
w.Overtime = w.Overtime.Round(time.Minute)