Only show trains with a full departure datetime

This commit is contained in:
Edward Betts 2024-03-11 10:46:18 +01:00
parent 96ab89b42f
commit 1ed6c50ad8

View file

@ -111,7 +111,11 @@ def travel_list() -> str:
"""Page showing a list of upcoming travel."""
data_dir = app.config["PERSONAL_DATA"]
flights = travel.parse_yaml("flights", data_dir)
trains = travel.parse_yaml("trains", data_dir)
trains = [
item
for item in travel.parse_yaml("trains", data_dir)
if isinstance(item["depart"], datetime)
]
return flask.render_template("travel.html", flights=flights, trains=trains)