From 9506e5e60e225b76013147173038402b66599ba3 Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Sat, 9 Dec 2023 11:37:52 +0000 Subject: [PATCH] Bug fix missing space launch data --- agenda/data.py | 2 +- agenda/thespacedevs.py | 5 ++++- templates/index.html | 10 +++++++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/agenda/data.py b/agenda/data.py index 25eca11..92efe09 100644 --- a/agenda/data.py +++ b/agenda/data.py @@ -266,7 +266,7 @@ async def get_data( if not dt: continue - rocket_name = f'🚀{launch["rocket"]}: {launch["mission"]["name"]}' + rocket_name = f'🚀{launch["rocket"]}: {launch["mission_name"] or "[no mission]"}' e = Event(name="rocket", date=dt, title=rocket_name) events.append(e) diff --git a/agenda/thespacedevs.py b/agenda/thespacedevs.py index 0feaf0d..6a995d1 100644 --- a/agenda/thespacedevs.py +++ b/agenda/thespacedevs.py @@ -96,6 +96,8 @@ def summarize_launch(launch: Launch) -> Summary: t0_date, t0_time = format_time(launch["net"], net_precision) + orbit = launch["mission"]["orbit"] if launch["mission"] else None + return { "name": launch["name"], "status": launch["status"], @@ -110,11 +112,12 @@ def summarize_launch(launch: Launch) -> Summary: "launch_provider_type": launch["launch_service_provider"]["type"], "rocket": launch["rocket"]["configuration"]["full_name"], "mission": launch["mission"], + "mission_name": (launch["mission"]["name"] if launch["mission"] else None), "pad_name": launch["pad"]["name"], "pad_wikipedia_url": launch["pad"]["wiki_url"], "location": launch["pad"]["location"]["name"], "country_code": launch["pad"]["country_code"], - "orbit": launch["mission"]["orbit"], + "orbit": orbit, } diff --git a/templates/index.html b/templates/index.html index 0c877c4..f5b9d0f 100644 --- a/templates/index.html +++ b/templates/index.html @@ -216,9 +216,13 @@ {% endif %} — {{ launch.location }}
- {% for line in launch.mission.description.splitlines() %} -

{{ line }}

- {% endfor %} + {% if launch.mission %} + {% for line in launch.mission.description.splitlines() %} +

{{ line }}

+ {% endfor %} + {% else %} +

No description.

+ {% endif %}