This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user