diff --git a/templates/timetable.html b/templates/timetable.html index c7ba24d7f644458e5e8fbd75ce2478a2c04009ae..f0dfa4d9f11142df8bb12fd797581fa659c9ca4d 100644 --- a/templates/timetable.html +++ b/templates/timetable.html @@ -15,36 +15,51 @@
{% for d in days if (d.index < 5) or (d.lectures|length) > 0 %}{% endfor %} + {# iterating over each 15 min block #} {% for t in times %} - {% set time_loop = loop %} - - {% if ((loop.index - 1) is divisibleby 4) %} {% endif %} - {% for d in days if (d.index < 5) or (d.lectures|length) > 0 %} - {% for i in range(1,d.maxcol+1) %} - {% for l in d.lectures|selectattr('timetable_col','equalto',i) if (((l.time.time() > t) and (l.time.time() < times[time_loop.index+1])) != (l.time.time() == t ) ) %} - - {% else %} - {% for l in d.lectures|selectattr('timetable_col','equalto',i) if (l.time.time() < t) and (l.time_end.time() > t) %} + {% set time_loop = loop %} + + {# display time in first row if its a full hour #} + {% if ((loop.index - 1) is divisibleby 4) %} {% endif %} + {# iterate over days if if it is a working day or we have lectures on that day (optionaly skip weekends) #} + {% for d in days if (d.index < 5) or (d.lectures|length) > 0 %} + {% for col in range(1,d.maxcol+1) %} + + {# iterate over all lextures but only consider those that are in the current column and happen in the 15 min block #} + {% for l in d.lectures|selectattr('timetable_col','equalto',col) if (((l.time.time() > t) and (l.time.time() < times[time_loop.index+1])) != (l.time.time() == t ) ) %} + {# handle the first column of a day specialy, set red background if hidden #} + {% else %} - + {# if the lecture is in the current collumn but not the current time slot #} + {% for l in d.lectures|selectattr('timetable_col','equalto',col) if (l.time.time() < t) and (l.time_end.time() > t) %} + {# this part is covered by another lecture using rowspan #} + {% else %} + {# no lecture right now, jsut end column #} + + {% endfor %} {% endfor %} + {# end lecture #} + {% endfor %} + {# end day column #} {% endfor %} - {% endfor %} - + {# end day #} + {% endfor %} + {# end 15 min block #}
{{ d.date.strftime("%A (%d.%m.%Y)") }}
{{ t.strftime("%H:%M") }} -

- - - {{l.course.short}} - - {{l.course.short}} - -
- {{l.time.strftime("%H:%M")}} - {{l.time_end.strftime("%H:%M")}}
- {{l.place}} -

-
{{ t.strftime("%H:%M") }} + {# print the lecture block #} +

+ + + {{l.course.short}} + + {{l.course.short}} + +
+ {{l.time.strftime("%H:%M")}} - {{l.time_end.strftime("%H:%M")}}
+ {{l.place}} +

+