From 98ed132430e05a19735113a70442bb5073965524 Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Sun, 5 Nov 2023 22:04:23 +0000 Subject: [PATCH] Look back two weeks in event list --- agenda/__init__.py | 2 ++ templates/index.html | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/agenda/__init__.py b/agenda/__init__.py index 4028a4d..b86d6d0 100644 --- a/agenda/__init__.py +++ b/agenda/__init__.py @@ -312,6 +312,7 @@ async def get_data(now: datetime) -> typing.Mapping[str, str | object]: """Get data to display on agenda dashboard.""" rocket_dir = os.path.join(data_dir, "thespacedevs") today = now.date() + two_weeks_ago = today - timedelta(weeks=2) last_week = today - timedelta(weeks=1) last_year = today - timedelta(days=365) next_year = today + timedelta(days=365) @@ -400,6 +401,7 @@ async def get_data(now: datetime) -> typing.Mapping[str, str | object]: reply["events"] = events reply["last_week"] = last_week + reply["two_weeks_ago"] = two_weeks_ago reply["fullcalendar_events"] = calendar.build_events(events) diff --git a/templates/index.html b/templates/index.html index 5a604a9..13a7e1c 100644 --- a/templates/index.html +++ b/templates/index.html @@ -113,7 +113,7 @@

Agenda

- {% for event in events if event.as_date >= last_week %} + {% for event in events if event.as_date >= two_weeks_ago %} {% if loop.first or event.date.year != loop.previtem.date.year %}