From 3330a2df1132c348d8bc2557053f056b7c104516 Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Sat, 17 Sep 2016 12:37:00 +0200 Subject: [PATCH] Request proper URL for agenda given year and group --- app.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/app.py b/app.py index 5477a79..1a565d5 100644 --- a/app.py +++ b/app.py @@ -7,10 +7,8 @@ app = Flask(__name__) FILTERED_COURSES = os.environ.get('COURSES', '').split(',') FILTERED_TYPES = os.environ.get('TYPES', '').split(',') -YEAR = int(os.environ.get('YEAR', '4')) -GROUP = int(os.environ.get('GROUP', '1')) -GENERAL_GROUP = int(os.environ.get('GENERAL_GROUP', '0')) -GROUPS = [GROUP, GENERAL_GROUP] +YEAR = os.environ.get('YEAR', '4') +GROUP = os.environ.get('GROUP', '1') @app.route("/") @@ -19,6 +17,7 @@ def hello(): if url is None: return "" + url += "&promo={year}&groupe={group}".format(year=YEAR, group=GROUP) cal_str = urllib.request.urlopen(url).read() cal = Component.from_ical(cal_str) @@ -42,15 +41,10 @@ def hello(): def should_add(event): course_code = event['SUMMARY'].split('-')[1].split('/')[0] course_type = event['SUMMARY'].split('/')[1].split('_')[1] - year = event['SUMMARY'][0] - group = event['SUMMARY'][-1] return \ course_code not in FILTERED_COURSES \ - and course_type not in FILTERED_TYPES \ - and year == YEAR \ - and group in GROUPS - + and course_type not in FILTERED_TYPES if __name__ == "__main__": port = int(os.environ.get('PORT', 5000))