Mache Start- und Endzeiten konfigurierbar
This commit is contained in:
parent
3db1627680
commit
f1dd952344
4 changed files with 63 additions and 14 deletions
|
@ -16,16 +16,24 @@ type maskData struct {
|
|||
Courses []models.Course
|
||||
Rooms []models.Room
|
||||
MinuteGranularity int
|
||||
SelectedCourse int
|
||||
SelectedRoom int
|
||||
Date models.Date
|
||||
Duration int
|
||||
Roomname string
|
||||
Name string
|
||||
Email string
|
||||
Info string
|
||||
Errors []string
|
||||
Config config.Config
|
||||
EarliestStartTime struct {
|
||||
Hour int
|
||||
Minute int
|
||||
}
|
||||
LatestStartTime struct {
|
||||
Hour int
|
||||
Minute int
|
||||
}
|
||||
SelectedCourse int
|
||||
SelectedRoom int
|
||||
Date models.Date
|
||||
Duration int
|
||||
Roomname string
|
||||
Name string
|
||||
Email string
|
||||
Info string
|
||||
Errors []string
|
||||
Config config.Config
|
||||
}
|
||||
|
||||
// Offer a form to add office hours and validate its input on receiving.
|
||||
|
@ -81,8 +89,11 @@ func (b *BaseHandler) AddOfficeHourHandler(w http.ResponseWriter, req *http.Requ
|
|||
if err != nil {
|
||||
errors = append(errors, "Die Stunde muss eine ganze Zahl sein.")
|
||||
}
|
||||
if !(hour >= 8 && hour <= 17) {
|
||||
errors = append(errors, fmt.Sprintf("Sprechstunden müssen zwischen 08:00 Uhr und 17:%d starten.", 60-b.config.Date.MinuteGranularity))
|
||||
if !(hour > b.config.Date.EarliestStartTime.Hour || (hour == b.config.Date.EarliestStartTime.Hour && minute >= b.config.Date.EarliestStartTime.Minute)) {
|
||||
errors = append(errors, fmt.Sprintf("Sprechstunden müssen nach %02d:%02d Uhr starten.", b.config.Date.EarliestStartTime.Hour, b.config.Date.EarliestStartTime.Minute))
|
||||
}
|
||||
if !(hour < b.config.Date.LatestStartTime.Hour || (hour == b.config.Date.LatestStartTime.Hour && minute <= b.config.Date.LatestStartTime.Minute)) {
|
||||
errors = append(errors, fmt.Sprintf("Sprechstunden müssen vor %02d:%02d Uhr starten.", b.config.Date.LatestStartTime.Hour, b.config.Date.LatestStartTime.Minute))
|
||||
}
|
||||
minute, err = strconv.Atoi(time[1])
|
||||
if err != nil {
|
||||
|
@ -132,6 +143,8 @@ func (b *BaseHandler) AddOfficeHourHandler(w http.ResponseWriter, req *http.Requ
|
|||
courses,
|
||||
rooms,
|
||||
b.config.Date.MinuteGranularity,
|
||||
b.config.Date.EarliestStartTime,
|
||||
b.config.Date.LatestStartTime,
|
||||
courseid,
|
||||
roomid,
|
||||
date,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue