Show 'today' heading at top of today

Closes: #80
This commit is contained in:
Edward Betts 2023-12-05 13:59:00 +00:00
parent c94e98acb1
commit 8cf0b982f0

View file

@ -2,7 +2,6 @@
import asyncio
import configparser
import operator
import os
import typing
from datetime import date, datetime, timedelta
@ -265,7 +264,6 @@ async def get_data(now: datetime) -> typing.Mapping[str, str | object]:
events += hn.whoishiring(last_year, next_year)
events += domains.renewal_dates(my_data)
events += [Event(name="today", date=today)]
for launch in rockets:
dt = None
@ -284,7 +282,8 @@ async def get_data(now: datetime) -> typing.Mapping[str, str | object]:
e = Event(name="rocket", date=dt, title=rocket_name)
events.append(e)
events.sort(key=operator.attrgetter("as_datetime"))
events += [Event(name="today", date=today)]
events.sort(key=lambda e: (e.as_datetime, e.name != "today"))
observer = sun.bristol()
reply["sunrise"] = sun.sunrise(observer)