Improve launch status UI and alert on SpaceDevs payload errors
This commit is contained in:
parent
458dfc5136
commit
7a50ea6016
3 changed files with 78 additions and 7 deletions
13
web_view.py
13
web_view.py
|
|
@ -177,11 +177,22 @@ async def recent() -> str:
|
|||
@app.route("/launches")
|
||||
def launch_list() -> str:
|
||||
"""Web page showing List of space launches."""
|
||||
now = datetime.now()
|
||||
now = datetime.now(timezone.utc)
|
||||
data_dir = app.config["DATA_DIR"]
|
||||
rocket_dir = os.path.join(data_dir, "thespacedevs")
|
||||
launches = agenda.thespacedevs.get_launches(rocket_dir, limit=100)
|
||||
assert launches
|
||||
active_crewed = agenda.thespacedevs.get_active_crewed_flights(rocket_dir) or []
|
||||
active_crewed_slugs = {
|
||||
launch["slug"]
|
||||
for launch in active_crewed
|
||||
if isinstance(launch.get("slug"), str)
|
||||
}
|
||||
|
||||
for launch in launches:
|
||||
launch_net = agenda.thespacedevs.parse_api_datetime(launch.get("net"))
|
||||
launch["is_future"] = bool(launch_net and launch_net > now)
|
||||
launch["is_active_crewed"] = launch.get("slug") in active_crewed_slugs
|
||||
|
||||
mission_type_filter = flask.request.args.get("type")
|
||||
rocket_filter = flask.request.args.get("rocket")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue