Avoid space launches with vague dates in agenda

Closes: #127
This commit is contained in:
Edward Betts 2024-02-11 07:42:45 +00:00
parent 3163bca99b
commit b66f852256

View file

@ -416,9 +416,16 @@ async def get_data(
for launch in rockets: for launch in rockets:
dt = None dt = None
if launch["net_precision"] == "Day": net_precision = launch["net_precision"]
skip = {"Year", "Month", "Quarter", "Fiscal Year"}
if net_precision == "Day":
dt = datetime.strptime(launch["net"], "%Y-%m-%dT%H:%M:%SZ").date() dt = datetime.strptime(launch["net"], "%Y-%m-%dT%H:%M:%SZ").date()
elif launch["t0_time"]: elif (
net_precision
and net_precision not in skip
and "Year" not in net_precision
and launch["t0_time"]
):
dt = pytz.utc.localize( dt = pytz.utc.localize(
datetime.strptime(launch["net"], "%Y-%m-%dT%H:%M:%SZ") datetime.strptime(launch["net"], "%Y-%m-%dT%H:%M:%SZ")
) )