Compare commits
3 commits
d55fea031c
...
5c68aea9a7
Author | SHA1 | Date | |
---|---|---|---|
5c68aea9a7 | |||
ed8c8bc5fd | |||
0b1988f2a8 |
1 changed files with 3 additions and 5 deletions
|
@ -50,8 +50,10 @@ 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 {
|
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("<p class=\"text-center\">Aktuell sind keine passenden Sprechstunden eingetragen.</p>")
|
||||||
|
}
|
||||||
var tableBody string
|
var tableBody string
|
||||||
var anyOfficeHourExists bool = false // do not show table if no entry in there
|
|
||||||
for hour := 8; hour < 19; hour += 1 {
|
for hour := 8; hour < 19; hour += 1 {
|
||||||
for minute := 0; minute < 60; minute += b.config.Date.MinuteGranularity {
|
for minute := 0; minute < 60; minute += b.config.Date.MinuteGranularity {
|
||||||
tableBody += "<tr>"
|
tableBody += "<tr>"
|
||||||
|
@ -94,7 +96,6 @@ func (b *BaseHandler) printTimetable(timetable map[models.Date]map[int]models.Of
|
||||||
// TODO: better error wrapping up to top-level request handler
|
// TODO: better error wrapping up to top-level request handler
|
||||||
}
|
}
|
||||||
tableBody += celldata.String()
|
tableBody += celldata.String()
|
||||||
anyOfficeHourExists = true
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if slot+1 == slots[day] {
|
if slot+1 == slots[day] {
|
||||||
|
@ -108,9 +109,6 @@ func (b *BaseHandler) printTimetable(timetable map[models.Date]map[int]models.Of
|
||||||
tableBody += "</tr>\n"
|
tableBody += "</tr>\n"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !anyOfficeHourExists {
|
|
||||||
return template.HTML("<p class=\"text-center\">Aktuell sind keine passenden Sprechstunden eingetragen.</p>")
|
|
||||||
}
|
|
||||||
var table bytes.Buffer
|
var table bytes.Buffer
|
||||||
|
|
||||||
tableData := struct {
|
tableData := struct {
|
||||||
|
|
Loading…
Reference in a new issue