Mache maximale Sprechstundenlänge konfigurierbar
This commit is contained in:
parent
a631c33883
commit
5a8a248c53
5 changed files with 12 additions and 4 deletions
|
@ -16,6 +16,7 @@ type maskData struct {
|
|||
Courses []models.Course
|
||||
Rooms []models.Room
|
||||
MinuteGranularity int
|
||||
MaxDuration int
|
||||
EarliestStartTime struct {
|
||||
Hour int
|
||||
Minute int
|
||||
|
@ -109,8 +110,8 @@ func (b *BaseHandler) AddOfficeHourHandler(w http.ResponseWriter, req *http.Requ
|
|||
if err != nil {
|
||||
errors = append(errors, "Die Dauer muss eine ganze Zahl sein.")
|
||||
}
|
||||
if !(duration >= b.config.Date.MinuteGranularity && duration <= 120 && duration%b.config.Date.MinuteGranularity == 0) {
|
||||
errors = append(errors, fmt.Sprintf("Sprechstunden müssen zwischen %d und 120 Minuten lang sein.", b.config.Date.MinuteGranularity))
|
||||
if !(duration >= b.config.Date.MinuteGranularity && duration <= b.config.Date.MaxDuration && duration%b.config.Date.MinuteGranularity == 0) {
|
||||
errors = append(errors, fmt.Sprintf("Sprechstunden müssen zwischen %d und %d Minuten lang sein.", b.config.Date.MinuteGranularity, b.config.Date.MaxDuration))
|
||||
}
|
||||
|
||||
roomname := req.FormValue("raumname")
|
||||
|
@ -144,6 +145,7 @@ func (b *BaseHandler) AddOfficeHourHandler(w http.ResponseWriter, req *http.Requ
|
|||
courses,
|
||||
rooms,
|
||||
b.config.Date.MinuteGranularity,
|
||||
b.config.Date.MaxDuration,
|
||||
b.config.Date.EarliestStartTime,
|
||||
b.config.Date.LatestStartTime,
|
||||
courseid,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue