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

@@ -113,13 +113,21 @@ func (u *User) GetAll() ([]User, error) {
return users, nil
}
// Returns the worktime per day rounded to minutes
func (u *User) ArbeitszeitProTag() time.Duration {
return time.Duration(u.ArbeitszeitPerTag * float32(time.Hour)).Round(time.Minute)
return u.ArbeitszeitProTagFrac(1)
}
// Returns the worktime per day rounded to minutes
func (u *User) ArbeitszeitProTagFrac(fraction float32) time.Duration {
return time.Duration(u.ArbeitszeitPerTag * float32(time.Hour) * fraction).Round(time.Minute)
}
func (u *User) ArbeitszeitProWoche() time.Duration {
return time.Duration(u.ArbeitszeitPerWoche * float32(time.Hour)).Round(time.Minute)
return u.ArbeitszeitProWocheFrac(1)
}
func (u *User) ArbeitszeitProWocheFrac(fraction float32) time.Duration {
return time.Duration(u.ArbeitszeitPerWoche * float32(time.Hour) * fraction).Round(time.Minute)
}
// Returns true if there is a booking 1 for today -> meaning the user is at work