diff --git a/timetable.py b/timetable.py index 42faf95e27848f1f43a32433310042c8602f8520..60ae61eb19c84af9ec1bcdf4df590613e6868a98 100644 --- a/timetable.py +++ b/timetable.py @@ -23,8 +23,10 @@ def timetable(): SELECT lectures.*,courses.short FROM lectures JOIN courses ON (lectures.course_id = courses.id) - ORDER BY time ASC'''): + WHERE time < ? and time > ? + ORDER BY time ASC''', i['date']+timedelta(weeks=2), i['date']-timedelta(weeks=2)): # we can not use the where clause of sql to match against the time, because sqlite and mysql use a different syntax -.- + # we still use it to only get the lectures for a 3 week periode if ((l['time'] < e) and (l['time'] > s)) or ((l['time'] + timedelta(minutes=l['duration']) < e) and (l['time'] + timedelta(minutes=l['duration'])> s)): i['lectures'].append(l) oldtime = l['time']