closes #38, #39, #40
All checks were successful
Tests / Run Go Tests (push) Successful in 37s

This commit is contained in:
2025-09-28 23:29:28 +02:00
parent e8f1113293
commit 90193e9346
22 changed files with 1556 additions and 1091 deletions

View File

@@ -24,15 +24,16 @@ type IWorkDay interface {
}
type WorkDay struct {
Day time.Time `json:"day"`
Bookings []Booking `json:"bookings"`
workTime time.Duration
pauseTime time.Duration
realWorkTime time.Duration
realPauseTime time.Duration
TimeFrom time.Time
TimeTo time.Time
kurzArbeit bool
Day time.Time `json:"day"`
Bookings []Booking `json:"bookings"`
workTime time.Duration
pauseTime time.Duration
realWorkTime time.Duration
realPauseTime time.Duration
TimeFrom time.Time
TimeTo time.Time
kurzArbeit bool
kurzArbeitAbsence Absence
}
func GetDays(user User, tsFrom, tsTo time.Time, orderedForward bool) []IWorkDay {
@@ -53,6 +54,7 @@ func GetDays(user User, tsFrom, tsTo time.Time, orderedForward bool) []IWorkDay
if day.AbwesenheitTyp.WorkTime == 1 {
if workDay, ok := allDays[day.Date().Format("2006-01-02")].(*WorkDay); ok {
workDay.kurzArbeit = true
workDay.kurzArbeitAbsence = day
}
} else {
allDays[day.Date().Format("2006-01-02")] = &day
@@ -85,6 +87,10 @@ func (d *WorkDay) TimeWorkVirtual(u User) time.Duration {
return d.workTime
}
func (d *WorkDay) GetKurzArbeit() Absence {
return d.kurzArbeitAbsence
}
func (d *WorkDay) TimeWorkReal(u User) time.Duration {
d.realWorkTime, d.realPauseTime = 0, 0
var lastBooking Booking