From 9b9a9d2773b21c2436f5983f00b91cdd114f9a29 Mon Sep 17 00:00:00 2001 From: Julian Rother <julianr@fsmpi.rwth-aachen.de> Date: Tue, 2 Jan 2018 00:50:41 +0100 Subject: [PATCH] Added limit parameter for ical exports --- icalexport.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/icalexport.py b/icalexport.py index b2edf35..fa90fdb 100644 --- a/icalexport.py +++ b/icalexport.py @@ -58,7 +58,8 @@ def get_responsible(): def ical_all(): return export_lectures(query('''SELECT lectures.*, "course" AS sep, courses.* FROM lectures JOIN courses ON courses.id = lectures.course_id - WHERE NOT norecording AND NOT external ORDER BY time DESC LIMIT 1000'''), + WHERE NOT norecording AND NOT external + ORDER BY time DESC LIMIT ?''', request.values.get('limit', 1000)), get_responsible(), 'videoag_all.ics') @app.route('/internal/ical/user/<int:user>') @@ -70,8 +71,8 @@ def ical_user(user): 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), get_responsible(), - 'videoag_%s.ics'%username) + ORDER BY time DESC LIMIT ?''', user, request.values.get('limit', 1000)), + get_responsible(), 'videoag_%s.ics'%username) @app.route('/internal/ical/notuser/<int:user>') @calperm @@ -82,8 +83,8 @@ def ical_notuser(user): 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), get_responsible(), - 'videoag_not_%s.ics'%username) + ORDER BY time DESC LIMIT ?''', user, request.values.get('limit', 1000)), + get_responsible(), 'videoag_not_%s.ics'%username) @app.route('/internal/ical/course/<course>') @calperm -- GitLab