Look back two weeks in event list
This commit is contained in:
parent
bc31db6143
commit
98ed132430
|
@ -312,6 +312,7 @@ async def get_data(now: datetime) -> typing.Mapping[str, str | object]:
|
||||||
"""Get data to display on agenda dashboard."""
|
"""Get data to display on agenda dashboard."""
|
||||||
rocket_dir = os.path.join(data_dir, "thespacedevs")
|
rocket_dir = os.path.join(data_dir, "thespacedevs")
|
||||||
today = now.date()
|
today = now.date()
|
||||||
|
two_weeks_ago = today - timedelta(weeks=2)
|
||||||
last_week = today - timedelta(weeks=1)
|
last_week = today - timedelta(weeks=1)
|
||||||
last_year = today - timedelta(days=365)
|
last_year = today - timedelta(days=365)
|
||||||
next_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["events"] = events
|
||||||
reply["last_week"] = last_week
|
reply["last_week"] = last_week
|
||||||
|
reply["two_weeks_ago"] = two_weeks_ago
|
||||||
|
|
||||||
reply["fullcalendar_events"] = calendar.build_events(events)
|
reply["fullcalendar_events"] = calendar.build_events(events)
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,7 @@
|
||||||
|
|
||||||
<h3>Agenda</h3>
|
<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 %}
|
{% if loop.first or event.date.year != loop.previtem.date.year %}
|
||||||
<div class="row mt-2">
|
<div class="row mt-2">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
|
|
Loading…
Reference in a new issue