From cde7516f366e07434c56ef4d9b3abd0ceb3f6129 Mon Sep 17 00:00:00 2001 From: Andreas <andreasv@fsmpi.rwth-aachen.de> Date: Tue, 18 Oct 2016 10:48:48 +0200 Subject: [PATCH] timetable will now show hidden lectures/courses in a different color. closes #168 --- templates/timetable.html | 4 ++-- timetable.py | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/templates/timetable.html b/templates/timetable.html index 25e10ef..4b29524 100644 --- a/templates/timetable.html +++ b/templates/timetable.html @@ -22,9 +22,9 @@ {% 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 ) ) %} - <td rowspan="{{l.duration / 15}}" style="background: lightgrey;"> + <td rowspan="{{l.duration / 15}}" style="background: {% if l.visible and l.course.visible %}lightgrey;{% else %}#f2dede{% endif %}"> <p class="small"> - <strong><a class="hidden-print" href="{{url_for('course', id=l.course_id)}}#lecture-{{l.id}}">{{l.short}}</a><span class="visible-print-inline">{{l.short}}</span></strong><br> + <strong><a class="hidden-print" href="{{url_for('course', id=l.course_id)}}#lecture-{{l.id}}">{{l.course.short}}</a><span class="visible-print-inline">{{l.course.short}}</span></strong><br> {{l.time.strftime("%H:%M")}} - {{l.time_end.strftime("%H:%M")}}<br> {{l.place}}</p> </td> diff --git a/timetable.py b/timetable.py index 0b036c0..a8e18be 100644 --- a/timetable.py +++ b/timetable.py @@ -23,7 +23,7 @@ def timetable(): e = datetime.combine(i['date'],time(23,59)) i['lectures'] = [] for l in query (''' - SELECT lectures.*,courses.short + SELECT lectures.*, courses.short, "course" AS sep, courses.* FROM lectures JOIN courses ON (lectures.course_id = courses.id) WHERE time < ? and time > ? @@ -55,7 +55,6 @@ def timetable(): unique = False if unique: tmp.append(x) - print(x[0],x[1],x[2]['short']) sweeplinetupels = sorted(tmp, key=lambda t:(t[0],t[1])) for l in sweeplinetupels: -- GitLab