Merge remote-tracking branch 'origin/main' into styling

This commit is contained in:
Johannes 2022-09-22 13:15:17 +02:00
commit 961a10915b
13 changed files with 193 additions and 74 deletions

View file

@ -2,6 +2,7 @@ package controllers
import (
"html/template"
"log"
"net/http"
"officeHours/models"
"strconv"
@ -18,7 +19,10 @@ func (b *BaseHandler) GetByRoomHandler(w http.ResponseWriter, req *http.Request)
b.RootHandler(w, req)
return
}
officeHours, _ := b.officeHourRepo.FindByRoom(room, true)
officeHours, err := b.officeHourRepo.FindByRoom(room, true)
if err != nil {
log.Printf("Error getting office hours for room %s: %s", room.Name, err.Error())
}
timetable, slots := b.GetTimetable(officeHours)
b.writeTimetablePage(w, req, b.printTimetable(timetable, slots, false))
}
@ -34,7 +38,10 @@ func (b *BaseHandler) GetByCourseHandler(w http.ResponseWriter, req *http.Reques
b.RootHandler(w, req)
return
}
officeHours, _ := b.officeHourRepo.FindByCourse(course, true)
officeHours, err := b.officeHourRepo.FindByCourse(course, true)
if err != nil {
log.Printf("Error getting office hours for course %s: %s", course.Name, err.Error())
}
timetable, slots := b.GetTimetable(officeHours)
b.writeTimetablePage(w, req, b.printTimetable(timetable, slots, false))
}