diff --git a/templates/accommodation.html b/templates/accommodation.html
new file mode 100644
index 0000000..5a78d6d
--- /dev/null
+++ b/templates/accommodation.html
@@ -0,0 +1,67 @@
+{% extends "base.html" %}
+{% block style %}
+
+{% endblock %}
+
+{% macro row(item, badge) %}
+
{{ item.from.strftime("%a, %d %b %Y") }}
+{{ item.to.strftime("%a, %d %b") }}
+{{ (item.to.date() - item.from.date()).days }}
+{{ item.name }}
+{{ item.operator }}
+{{ item.location }}
+{% endmacro %}
+
+{% macro section(heading, item_list, badge) %}
+{% if item_list %}
+{{heading}}
+{% for item in item_list %}{{ row(item, badge) }}{% endfor %}
+{% endif %}
+{% endmacro %}
+
+{% block content %}
+
+
+
+
Accommodation
+
+
+ ← back to agenda
+ |
+ travel
+ |
+ conference
+ |
+ gaps
+ |
+ accommodation
+
+
+
+
+
+ - Total nights away in 2024: {{ total_nights_2024 }}
+ - Total nights abroad in 2024: {{ nights_abroad_2024 }}
+
+
+
+ {{ section("Accommodation", items) }}
+
+
+
+{% endblock %}
diff --git a/templates/conference_list.html b/templates/conference_list.html
index 0190d94..05bd4e7 100644
--- a/templates/conference_list.html
+++ b/templates/conference_list.html
@@ -61,6 +61,8 @@
conference
|
gaps
+ |
+ accommodation
diff --git a/templates/gaps.html b/templates/gaps.html
index d4487b7..cbb5e5c 100644
--- a/templates/gaps.html
+++ b/templates/gaps.html
@@ -12,6 +12,8 @@
conference
|
gaps
+ |
+
accommodation
diff --git a/templates/index.html b/templates/index.html
index 2dcf2c8..81d30ff 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -115,6 +115,8 @@
conference
|
gaps
+ |
+
accommodation
diff --git a/templates/travel.html b/templates/travel.html
index c4f3b8e..b7666a0 100644
--- a/templates/travel.html
+++ b/templates/travel.html
@@ -44,6 +44,8 @@
conference
|
gaps
+ |
+ accommodation
flights
diff --git a/web_view.py b/web_view.py
index 4437ed0..86db0a2 100755
--- a/web_view.py
+++ b/web_view.py
@@ -111,5 +111,30 @@ def conference_list() -> str:
)
+@app.route("/accommodation")
+def accommodation_list() -> str:
+ """Page showing a list of past, present and future accommodation."""
+ data_dir = app.config["PERSONAL_DATA"]
+ items = agenda.travel.parse_yaml("accommodation", data_dir)
+
+ stays_in_2024 = [item for item in items if item["from"].year == 2024]
+ total_nights_2024 = sum(
+ (stay["to"].date() - stay["from"].date()).days for stay in stays_in_2024
+ )
+
+ nights_abroad_2024 = sum(
+ (stay["to"].date() - stay["from"].date()).days
+ for stay in stays_in_2024
+ if stay["country"] != "gb"
+ )
+
+ return flask.render_template(
+ "accommodation.html",
+ items=items,
+ total_nights_2024=total_nights_2024,
+ nights_abroad_2024=nights_abroad_2024,
+ )
+
+
if __name__ == "__main__":
app.run(host="0.0.0.0")