diff --git a/controllers/addOfficeHourHandler.go b/controllers/addOfficeHourHandler.go index 20c3b8d..4e498e1 100644 --- a/controllers/addOfficeHourHandler.go +++ b/controllers/addOfficeHourHandler.go @@ -73,8 +73,8 @@ func (b *BaseHandler) AddOfficeHourHandler(w http.ResponseWriter, req *http.Requ if err != nil { errors = append(errors, "Die Vorlesungswoche muss eine ganze Zahl sein.") } - if !(week >= 0 && week <= 2) { - errors = append(errors, "Sprechstunden müssen jede, jede gerade oder jede ungerade Vorlesungswoche stattfinden.") + if !(week >= 0 && week <= 5) { + errors = append(errors, "Bitte wähle eine der vorgegebenen Optionen für Vorlesungswochen.") } day, err := strconv.Atoi(req.FormValue("tag")) if err != nil { diff --git a/models/date.go b/models/date.go index 61ce6a3..bea4dc4 100644 --- a/models/date.go +++ b/models/date.go @@ -5,7 +5,7 @@ import ( ) type Date struct { - Week int // Set whether the date is all weeks (0), odd weeks (1) or even weeks (2). + Week int // Set whether the date is all weeks (0), weeks with exercise session (1) or weeks without exercise session (2), even weeks (3), odd weeks (4) or other (5). Day int Hour int Minute int diff --git a/repositories/officeHour.go b/repositories/officeHour.go index 27ccd86..4a0243a 100644 --- a/repositories/officeHour.go +++ b/repositories/officeHour.go @@ -245,9 +245,7 @@ func (r *OfficeHourRepo) NumberByTimeSpanAndRoom(date models.Date, duration int, for _, officeHour := range officeHours { // increase count if officehour starts before this point in time and ends later if models.DateLess(officeHour.Date, models.GetEndDate(date, minute, false)) && models.DateLess(models.GetEndDate(date, minute, false), models.GetEndDate(officeHour.Date, officeHour.Duration, false)) { - if date.Week == 0 || officeHour.Week == 0 || date.Week == officeHour.Week { // office hours in alternating weeks should not collide - minuteCount += 1 - } + minuteCount += 1 } } if minuteCount > count { diff --git a/templating/templates/addMask.html b/templating/templates/addMask.html index 98152d7..eda37d7 100644 --- a/templating/templates/addMask.html +++ b/templating/templates/addMask.html @@ -59,9 +59,12 @@
Willst du die Sprechstunde
{{printf "%02d" .OfficeHour.Date.Hour}}:{{printf "%02d" .OfficeHour.Date.Minute}} - {{printf "%02d" .OfficeHour.EndDate.Hour}}:{{printf "%02d" .OfficeHour.EndDate.Minute}}
- {{if eq .OfficeHour.Date.Week 1}}in ungeraden Vorlesungswochen
{{end}}{{if eq .OfficeHour.Date.Week 2}}in geraden Vorlesungswochen
{{end}}
+ {{if eq 0 $.Date.Week}}>Jede Woche
{{end}}{{if eq 1 $.Date.Week}}In Wochen mit Übung
{{end}}{{if eq 2 $.Date.Week}}In Wochen ohne Übung
{{end}}{{if eq 3 $.Date.Week}}In geraden Vorlesungswochen
{{end}}{{if eq 4 $.Date.Week}}In ungeraden Vorlesungswochen
{{end}}
{{.OfficeHour.Course.Name}}
{{.OfficeHour.Tutor.Name}}
{{.OfficeHour.Room.Name}}
diff --git a/templating/templates/td.html b/templating/templates/td.html
index cb1f041..76fc5e1 100644
--- a/templating/templates/td.html
+++ b/templating/templates/td.html
@@ -1,7 +1,7 @@