Mache maximale Sprechstundenlänge konfigurierbar
This commit is contained in:
parent
a631c33883
commit
5a8a248c53
5 changed files with 12 additions and 4 deletions
|
@ -24,6 +24,7 @@ type Config struct {
|
|||
}
|
||||
Date struct {
|
||||
MinuteGranularity int // Restricts the minutes on which office hours can start and end to multiples of it.
|
||||
MaxDuration int // Limits the length of office hours to minutes
|
||||
EarliestStartTime struct {
|
||||
Hour int
|
||||
Minute int
|
||||
|
@ -103,6 +104,10 @@ func validateConfig(conf *Config) error {
|
|||
err = fmt.Errorf("Validating config: Earliest start time minute must be between 0 and 60, but is %d.", conf.Date.EarliestStartTime.Minute)
|
||||
log.Println(err.Error())
|
||||
}
|
||||
if !(conf.Date.MaxDuration >= conf.Date.MinuteGranularity && conf.Date.MaxDuration <= 4*60) {
|
||||
err = fmt.Errorf("Validating config: Maximum duration must be between %d minute and 4 hours, but is %d.", conf.Date.MinuteGranularity, conf.Date.MaxDuration)
|
||||
log.Println(err.Error())
|
||||
}
|
||||
if !(conf.Date.LatestStartTime.Hour >= 0 && conf.Date.LatestStartTime.Hour <= 23) {
|
||||
err = fmt.Errorf("Validating config: Latest start time hour must be between 0 and 23, but is %d.", conf.Date.LatestStartTime.Hour)
|
||||
log.Println(err.Error())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue