diff --git a/templates/accommodation.html b/templates/accommodation.html index 8109ad8..d2df5e6 100644 --- a/templates/accommodation.html +++ b/templates/accommodation.html @@ -42,9 +42,7 @@
- {{ section("Past", past) }} - {{ section("Current", current) }} - {{ section("Future", future) }} + {{ section("Accommodation", items) }}
diff --git a/web_view.py b/web_view.py index 09f53ce..e927b49 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, uk_tz +from agenda import format_list_with_ampersand, travel from agenda.types import StrDict app = flask.Flask(__name__) @@ -139,7 +139,7 @@ def conference_list() -> str: """Page showing a list of conferences.""" data_dir = app.config["PERSONAL_DATA"] filepath = os.path.join(data_dir, "conferences.yaml") - items = yaml.safe_load(open(filepath)) + item_list = yaml.safe_load(open(filepath)) today = date.today() conference_trip_lookup = {} @@ -148,7 +148,7 @@ def conference_list() -> str: key = (trip_conf["start"], trip_conf["name"]) conference_trip_lookup[key] = trip - for conf in items: + for conf in item_list: conf["start_date"] = as_date(conf["start"]) conf["end_date"] = as_date(conf["end"]) @@ -156,15 +156,16 @@ def conference_list() -> str: if this_trip := conference_trip_lookup.get(key): conf["linked_trip"] = this_trip - items.sort(key=operator.itemgetter("start_date")) + item_list.sort(key=operator.itemgetter("start_date")) - past = [conf for conf in items if conf["end_date"] < today] current = [ conf - for conf in items + for conf in item_list if conf["start_date"] <= today and conf["end_date"] >= today ] - future = [conf for conf in items if conf["start_date"] > today] + + past = [conf for conf in item_list if conf["end_date"] < today] + future = [conf for conf in item_list if conf["start_date"] > today] return flask.render_template( "conference_list.html", @@ -205,17 +206,9 @@ 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", - past=past, - current=current, - future=future, + items=items, total_nights_2024=total_nights_2024, nights_abroad_2024=nights_abroad_2024, get_country=agenda.get_country,