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