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 asyncio
import configparser import configparser
import operator
import os import os
import typing import typing
from datetime import date, datetime, timedelta 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 += hn.whoishiring(last_year, next_year)
events += domains.renewal_dates(my_data) events += domains.renewal_dates(my_data)
events += [Event(name="today", date=today)]
for launch in rockets: for launch in rockets:
dt = None 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) e = Event(name="rocket", date=dt, title=rocket_name)
events.append(e) 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() observer = sun.bristol()
reply["sunrise"] = sun.sunrise(observer) reply["sunrise"] = sun.sunrise(observer)