Commit 5c36d6f3 authored by Julian Rother's avatar Julian Rother
Browse files

Reworked ical queries and added limit to them

parent 996194dd
......@@ -46,21 +46,13 @@ def calperm(func):
return redirect(url_for('index'))
return decorator
@app.route('/internal/ical/semester/<semester>')
@calperm
def ical_semester(semester):
if semester == 'zeitlos':
semester_q = ''
else:
semester_q = semester
return export_lectures(query('SELECT lectures.* FROM lectures JOIN courses ON courses.id = lectures.course_id WHERE courses.semester = ? AND lectures.visible = 1', semester_q),'videoag_semester_'+semester+'.ics')
@app.route('/internal/ical/all')
@calperm
def ical_all():
return export_lectures(query('SELECT lectures.* FROM lectures WHERE lectures.visible = 1'),'videoag_all.ics')
return export_lectures(query('''SELECT lectures.* FROM lectures JOIN courses ON courses.id = lectures.course_id
WHERE NOT norecording AND NOT external ORDER BY time DESC LIMIT 1000'''),'videoag_all.ics')
@app.route('/internal/ical/course/<course>')
@calperm
def ical_course(course):
return export_lectures(query('SELECT lectures.* FROM lectures JOIN courses ON courses.id = lectures.course_id WHERE courses.handle = ? AND lectures.visible = 1', course),'videoag_course_'+course+'.ics')
return export_lectures(query('SELECT lectures.* FROM lectures JOIN courses ON courses.id = lectures.course_id WHERE courses.handle = ? AND NOT norecording AND NOT external ORDER BY time DESC', course),'videoag_course_'+course+'.ics')
Supports Markdown
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