using IWorkDay interface for team
All checks were successful
Tests / Run Go Tests (push) Successful in 42s

This commit is contained in:
2025-09-25 21:52:53 +02:00
parent db6fc10c28
commit e8f1113293
7 changed files with 141 additions and 83 deletions

View File

@@ -4,7 +4,6 @@ import (
"database/sql"
"errors"
"log"
"sort"
"time"
)
@@ -46,10 +45,7 @@ func NewWorkWeek(user User, tsMonday time.Time, populate bool) WorkWeek {
}
func (w *WorkWeek) PopulateWithDays(worktime time.Duration, overtime time.Duration) {
w.Days = GetDays(w.User, w.WeekStart, w.WeekStart.Add(6*24*time.Hour))
sort.Slice(w.Days, func(i, j int) bool {
return w.Days[i].Date().Before(w.Days[j].Date())
})
w.Days = GetDays(w.User, w.WeekStart, w.WeekStart.Add(6*24*time.Hour), false)
for _, day := range w.Days {
w.Worktime += day.TimeWorkVirtual(w.User)