Sprechstunden löschen
This commit is contained in:
parent
78af58a51d
commit
2ce7a1fae1
15 changed files with 100 additions and 34 deletions
|
@ -47,10 +47,13 @@ func GetTimetable(officeHours []models.OfficeHour) (timetable map[models.Date]ma
|
|||
return fullTimetable, slots
|
||||
}
|
||||
|
||||
func printTimetable(timetable map[models.Date]map[int]models.OfficeHour, slots []int) template.HTML {
|
||||
func printTimetable(timetable map[models.Date]map[int]models.OfficeHour, slots []int, deleteIcons bool) template.HTML {
|
||||
var tableBody string
|
||||
|
||||
tableCell, _ := template.ParseFiles("templates/td.html")
|
||||
tableCell, _ := template.New("td.html").
|
||||
Funcs(template.FuncMap{"mod": func(i int, j int) int { return i % j },
|
||||
"add": func(i int, j int) int { return i + j },
|
||||
"divide": func(i int, j int) int { return i / j }}).ParseFiles("templates/td.html")
|
||||
for hour := 8; hour < 19; hour += 1 {
|
||||
for minute := 0; minute < 60; minute += models.MinuteGranularity {
|
||||
tableBody += "<tr>"
|
||||
|
@ -82,23 +85,10 @@ func printTimetable(timetable map[models.Date]map[int]models.OfficeHour, slots [
|
|||
} else {
|
||||
var celldata bytes.Buffer
|
||||
data := struct {
|
||||
Rowspan int
|
||||
StartHour int
|
||||
StartMinute int
|
||||
EndHour int
|
||||
EndMinute int
|
||||
CourseName string
|
||||
TutorName string
|
||||
RoomName string
|
||||
}{current.Duration / models.MinuteGranularity,
|
||||
current.Hour,
|
||||
current.Minute,
|
||||
current.Hour + ((current.Minute + current.Duration) / 60),
|
||||
(current.Minute + current.Duration) % 60,
|
||||
template.HTMLEscapeString(current.Course.Name),
|
||||
current.Tutor.Name,
|
||||
current.Room.Name,
|
||||
}
|
||||
OfficeHour models.OfficeHour
|
||||
MinuteGranularity int
|
||||
DeleteIcons bool
|
||||
}{current, models.MinuteGranularity, deleteIcons}
|
||||
tableCell.Execute(&celldata, data)
|
||||
tableBody += celldata.String()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue