Look back two weeks in event list

This commit is contained in:
Edward Betts 2023-11-05 22:04:23 +00:00
parent bc31db6143
commit 98ed132430
2 changed files with 3 additions and 1 deletions

View file

@ -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)

View file

@ -113,7 +113,7 @@
<h3>Agenda</h3>
{% 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 %}
<div class="row mt-2">
<div class="col">