Compare commits

..

No commits in common. "259642ff52bd145907f9544232148e4e4fff7791" and "cf298f261f839f988eab7438742590a263bd7ce5" have entirely different histories.

2 changed files with 7 additions and 30 deletions

View file

@ -39,7 +39,6 @@
} %} } %}
{% from "macros.html" import trip_link, display_date_no_year with context %}
{% from "navbar.html" import navbar with context %} {% from "navbar.html" import navbar with context %}
<body> <body>
@ -80,19 +79,6 @@
<p>{{ market }}</p> <p>{{ market }}</p>
{% endfor %} {% endfor %}
{% if current_trip %}
{% set end = current_trip.end %}
<div>
<div>Current trip: {{ trip_link(current_trip) }}</div>
{% if end %}
<div>Dates: {{ display_date_no_year(current_trip.start) }} to {{ display_date_no_year(end) }}</div>
{% else %}
<div>Start: {{ display_date_no_year(current_trip.start) }} (end date missing)</div>
{% endif %}
</div>
{% endif %}
<h3>Agenda</h3> <h3>Agenda</h3>
<div> <div>

View file

@ -68,19 +68,6 @@ def exception_handler(e: werkzeug.exceptions.InternalServerError) -> tuple[str,
) )
def get_current_trip(today: date) -> Trip | None:
"""Get current trip."""
trip_list = get_trip_list(route_distances=None)
current = [
item
for item in trip_list
if item.start <= today and (item.end or item.start) >= today
]
assert len(current) < 2
return current[0] if current else None
@app.route("/") @app.route("/")
async def index() -> str: async def index() -> str:
"""Index page.""" """Index page."""
@ -100,7 +87,6 @@ async def index() -> str:
"event_list.html", "event_list.html",
today=now.date(), today=now.date(),
events=events, events=events,
current_trip=get_current_trip(now.date()),
fullcalendar_events=calendar.build_events(events), fullcalendar_events=calendar.build_events(events),
start_event_list=date.today() - timedelta(days=1), start_event_list=date.today() - timedelta(days=1),
end_event_list=date.today() + timedelta(days=365 * 2), end_event_list=date.today() + timedelta(days=365 * 2),
@ -256,6 +242,11 @@ def travel_list() -> str:
) )
def as_date(d: date | datetime) -> date:
"""Date of event."""
return d.date() if isinstance(d, datetime) else d
def build_conference_list() -> list[StrDict]: def build_conference_list() -> list[StrDict]:
"""Build conference list.""" """Build conference list."""
data_dir = app.config["PERSONAL_DATA"] data_dir = app.config["PERSONAL_DATA"]
@ -269,8 +260,8 @@ def build_conference_list() -> list[StrDict]:
conference_trip_lookup[key] = trip conference_trip_lookup[key] = trip
for conf in items: for conf in items:
conf["start_date"] = agenda.utils.as_date(conf["start"]) conf["start_date"] = as_date(conf["start"])
conf["end_date"] = agenda.utils.as_date(conf["end"]) conf["end_date"] = as_date(conf["end"])
price = conf.get("price") price = conf.get("price")
if price: if price: