diff --git a/templates/accommodation.html b/templates/accommodation.html
index d2df5e6..8109ad8 100644
--- a/templates/accommodation.html
+++ b/templates/accommodation.html
@@ -42,7 +42,9 @@
- {{ section("Accommodation", items) }}
+ {{ section("Past", past) }}
+ {{ section("Current", current) }}
+ {{ section("Future", future) }}
diff --git a/web_view.py b/web_view.py
index e927b49..d34be5d 100755
--- a/web_view.py
+++ b/web_view.py
@@ -21,7 +21,7 @@ import agenda.error_mail
import agenda.holidays
import agenda.thespacedevs
import agenda.trip
-from agenda import format_list_with_ampersand, travel
+from agenda import format_list_with_ampersand, travel, uk_tz
from agenda.types import StrDict
app = flask.Flask(__name__)
@@ -206,9 +206,17 @@ def accommodation_list() -> str:
if this_trip := trip_lookup.get(key):
item["linked_trip"] = this_trip
+ now = uk_tz.localize(datetime.now())
+
+ past = [conf for conf in items if conf["to"] < now]
+ current = [conf for conf in items if conf["from"] <= now and conf["to"] >= now]
+ future = [conf for conf in items if conf["from"] > now]
+
return flask.render_template(
"accommodation.html",
- items=items,
+ past=past,
+ current=current,
+ future=future,
total_nights_2024=total_nights_2024,
nights_abroad_2024=nights_abroad_2024,
get_country=agenda.get_country,