Provide station name even if no departures. Fixes #2
This commit is contained in:
parent
e461314187
commit
1b07e4f91b
@ -191,6 +191,9 @@ def latest():
|
|||||||
|
|
||||||
if len(departures['departures']) == 0:
|
if len(departures['departures']) == 0:
|
||||||
# Invalid stop ID, platform ID, no departures, etc.
|
# Invalid stop ID, platform ID, no departures, etc.
|
||||||
|
# Set stop name manually
|
||||||
|
get_station_list()
|
||||||
|
result['stop_name'] = next((v for k, v in stns if k == int(flask.request.args['stop_id'])), 'Unknown station')
|
||||||
return flask.jsonify(result)
|
return flask.jsonify(result)
|
||||||
|
|
||||||
result['stop_name'] = stop_to_name(departures['stops'][flask.request.args['stop_id']], None)
|
result['stop_name'] = stop_to_name(departures['stops'][flask.request.args['stop_id']], None)
|
||||||
|
Loading…
Reference in New Issue
Block a user