From 6f7f77831265b6d9ad52adde0f0a63d9d0d5c031 Mon Sep 17 00:00:00 2001 From: RunasSudo Date: Sat, 12 Jan 2019 11:15:59 +1100 Subject: [PATCH] Implement all platforms display --- virtual_metro/__init__.py | 6 +++++- virtual_metro/templates/index.html | 13 ++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/virtual_metro/__init__.py b/virtual_metro/__init__.py index a1be5e7..c69c949 100755 --- a/virtual_metro/__init__.py +++ b/virtual_metro/__init__.py @@ -182,7 +182,11 @@ def latest(): result = {} result['time_offset'] = timenow.utcoffset().total_seconds() - departures = do_request('/v3/departures/route_type/{}/stop/{}'.format(ROUTE_TYPE, flask.request.args['stop_id']), {'platform_numbers': flask.request.args['plat_id'], 'max_results': '5', 'expand': 'all'}, cachetime=60) + args = {'max_results': '5', 'expand': 'all'} + if flask.request.args['plat_id'] != '0': + args['platform_numbers'] = flask.request.args['plat_id'] + + departures = do_request('/v3/departures/route_type/{}/stop/{}'.format(ROUTE_TYPE, flask.request.args['stop_id']), args, cachetime=60) departures['departures'].sort(key=lambda x: x['scheduled_departure_utc']) if len(departures['departures']) == 0: diff --git a/virtual_metro/templates/index.html b/virtual_metro/templates/index.html index 1d4652b..68b6b2c 100644 --- a/virtual_metro/templates/index.html +++ b/virtual_metro/templates/index.html @@ -37,7 +37,7 @@ -
Stop ? [change] Platform ? [change] Style ? [change: 1, 2]
+
Stop ? [change] Platform ? [change] Style ? [change: 1, 2]
By RunasSudo · AGPLv3 · Source Code · Data from PTV licensed under CC BY 4.0