Commit 11af9c35 authored by Andreas Valder's avatar Andreas Valder

renmed video endpoint to course endpoint, courseid can now be an int

parent b9365fd3
......@@ -64,7 +64,7 @@ def index():
LIMIT 6
''', ismod()))
@app.route('/videos')
@app.route('/course')
@register_navbar('Videos', icon='film')
def videos():
courses = query('SELECT * FROM courses WHERE (? OR (visible AND listed))', ismod())
......@@ -111,7 +111,7 @@ def search():
@app.route('/course/<id>')
def course(id):
courses = query('SELECT * FROM courses WHERE handle = ? AND (? OR visible)', id, ismod())
courses = query('SELECT * FROM courses WHERE ((handle = ?) or id = ?) AND (? OR visible)', id, id, ismod())
if not courses:
flash('Diese Veranstaltung existiert nicht!')
return app.view_functions['videos'](), 404
......@@ -205,7 +205,13 @@ def schedule():
# date and times are burning in sqlite
s = datetime.combine(i['date'],time())
e = datetime.combine(i['date'],time(23,59))
i['lectures'] = query ('SELECT lectures.*,courses.* FROM lectures JOIN courses ON (lectures.course_id = courses.id) WHERE (time < ?) AND (time > ?) ORDER BY time ASC',e,s);
i['lectures'] = query ('''
SELECT lectures.*,courses.short
FROM lectures
JOIN courses ON (lectures.course_id = courses.id)
WHERE (time < ?) AND (time > ?)
ORDER BY time ASC'''
,e,s);
# sweepline to find out how many lectures overlap
maxcol=0;
curcol=0;
......
......@@ -17,7 +17,7 @@
{% for l in d.lectures|selectattr('schedule_col','equalto',i) if (((l.time_asdate.time() > t) and (l.time_asdate.time() < times[time_loop.index+1])) != (l.time_asdate.time() == t ) ) %}
<td rowspan="{{l.duration / 15}}" style="background: lightgrey;">
<p class="small">
<strong><a href="{{url_for('course', id=l['handle'])}}#{{l.id}}">{{l.short}}</a></strong><br>
<strong><a href="{{url_for('course', id=l['course_id'])}}#{{l.id}}">{{l.short}}</a></strong><br>
{{l.time_asdate.strftime("%H:%M")}} - {{l.end_asdate.strftime("%H:%M")}}<br>
{{l.place}}</p>
</td>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment