Skip to content
Snippets Groups Projects
Commit ffad2ba1 authored by Julian Rother's avatar Julian Rother
Browse files

Implemented user-specific ical exports

parent 3eaf9cfc
No related branches found
No related tags found
No related merge requests found
......@@ -52,6 +52,28 @@ def ical_all():
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/user/<int:user>')
@calperm
def ical_user(user):
username = query('SELECT name FROM users WHERE users.id = ?', user)[0]['name']
return export_lectures(query('''SELECT lectures.*, "course" AS sep, courses.*
FROM lectures
JOIN courses ON courses.id = lectures.course_id
JOIN responsible ON responsible.course_id = courses.id
WHERE NOT norecording AND NOT external AND responsible.user_id = ?
ORDER BY time DESC LIMIT 1000''', user),'videoag_%s.ics'%username)
@app.route('/internal/ical/notuser/<int:user>')
@calperm
def ical_notuser(user):
username = query('SELECT name FROM users WHERE users.id = ?', user)[0]['name']
return export_lectures(query('''SELECT lectures.*, "course" AS sep, courses.*
FROM lectures
JOIN courses ON courses.id = lectures.course_id
LEFT JOIN responsible ON (responsible.course_id = courses.id AND responsible.user_id = ?)
WHERE NOT norecording AND NOT external AND responsible.user_id IS NULL
ORDER BY time DESC LIMIT 1000''', user),'videoag_not_%s.ics'%username)
@app.route('/internal/ical/course/<course>')
@calperm
def ical_course(course):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment