Compare commits

...

2 commits

Author SHA1 Message Date
Edward Betts bc4d956042 Types 2025-08-01 06:21:22 +01:00
Edward Betts 8901bc9bbb Bug fix 2025-08-01 06:21:22 +01:00
2 changed files with 13 additions and 11 deletions

View file

@ -197,15 +197,18 @@ def calculate_meteor_shower_data(year: int) -> list[MeteorShower]:
for shower_id, shower_info in METEOR_SHOWERS.items():
# Calculate peak date based on solar longitude
peak_date = calculate_solar_longitude_date(
year, shower_info["peak_solar_longitude"]
)
peak_longitude = shower_info["peak_solar_longitude"]
assert isinstance(peak_longitude, (int, float))
peak_date = calculate_solar_longitude_date(year, peak_longitude)
# Calculate activity period
activity_start = calculate_solar_longitude_date(
year, shower_info["activity_start"]
)
activity_end = calculate_solar_longitude_date(year, shower_info["activity_end"])
start_longitude = shower_info["activity_start"]
assert isinstance(start_longitude, (int, float))
activity_start = calculate_solar_longitude_date(year, start_longitude)
end_longitude = shower_info["activity_end"]
assert isinstance(end_longitude, (int, float))
activity_end = calculate_solar_longitude_date(year, end_longitude)
# Calculate moon phase at peak
moon_illumination, moon_phase_desc = calculate_moon_phase(peak_date)
@ -235,9 +238,9 @@ def calculate_meteor_shower_data(year: int) -> list[MeteorShower]:
"peak": peak_formatted,
"active": active_formatted,
"rate": f"{shower_info['rate_min']}-{shower_info['rate_max']} meteors per hour",
"radiant": shower_info["radiant_ra"].split("h")[0]
"radiant": str(shower_info["radiant_ra"]).split("h")[0]
+ "h "
+ shower_info["radiant_dec"],
+ str(shower_info["radiant_dec"]),
"moon_phase": moon_phase_desc,
"visibility": shower_info["visibility"],
"description": shower_info["description"],
@ -255,7 +258,7 @@ def calculate_meteor_shower_data(year: int) -> list[MeteorShower]:
meteor_data.append(meteor_shower)
# Sort by peak date
meteor_data.sort(key=lambda x: datetime.strptime(x["peak_date"], "%Y-%m-%d"))
meteor_data.sort(key=lambda x: datetime.strptime(str(x["peak_date"]), "%Y-%m-%d"))
return meteor_data

View file

@ -158,7 +158,6 @@ async def recent() -> str:
"event_list.html",
today=now.date(),
events=events,
fullcalendar_events=calendar.build_events(events),
start_event_list=date.today() - timedelta(days=14),
end_event_list=date.today(),
render_time=(time.time() - t0),