From 0b1988f2a851783e1d7d2faf0a68e73c8b8508ee Mon Sep 17 00:00:00 2001 From: Johannes Date: Sun, 9 Jul 2023 15:26:58 +0200 Subject: [PATCH] ux: hide officeHourTable if it has no entries at all --- controllers/timetable.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/controllers/timetable.go b/controllers/timetable.go index 58267dd..654d310 100644 --- a/controllers/timetable.go +++ b/controllers/timetable.go @@ -50,6 +50,9 @@ func (b *BaseHandler) GetTimetable(officeHours []models.OfficeHour) (timetable m } func (b *BaseHandler) printTimetable(timetable map[models.Date]map[int]models.OfficeHour, slots []int, deleteIcons bool) template.HTML { + if len(timetable) == 0 { // no office hours to display + return template.HTML("

Aktuell sind keine passenden Sprechstunden eingetragen.

") + } var tableBody string for hour := 8; hour < 19; hour += 1 { for minute := 0; minute < 60; minute += b.config.Date.MinuteGranularity {