From 8cf0b982f0a0a714f92415af8b2aa35f8778831f Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Tue, 5 Dec 2023 13:59:00 +0000 Subject: [PATCH] Show 'today' heading at top of today Closes: #80 --- agenda/data.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/agenda/data.py b/agenda/data.py index 52fbaa1..c0f2712 100644 --- a/agenda/data.py +++ b/agenda/data.py @@ -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)