{% extends "base.html" %} {% from "macros.html" import trip_link, display_date_no_year, display_date, display_datetime, display_time with context %} {% block title %}{{ heading }} - Edward Betts{% endblock %} {% block style %} {% endblock %} {% macro section(heading, item_list) %} {% if item_list %} {% set items = item_list | list %}

{{ heading }}

{{ items | count }} trips

{% for trip in items %} {% set distances_by_transport_type = trip.distances_by_transport_type() %} {% set total_distance = trip.total_distance() %} {% set end = trip.end %}

{{ trip_link(trip) }} ({{ display_date(trip.start) }})

{% if end %}
Dates: {{ display_date_no_year(trip.start) }} to {{ display_date_no_year(end) }}
{% else %}
Start: {{ display_date_no_year(trip.start) }} (end date missing)
{% endif %} {% if total_distance %}
Total distance: {{ "{:,.0f} km / {:,.0f} miles".format(total_distance, total_distance / 1.60934) }}
{% endif %} {% if distances_by_transport_type %} {% for transport_type, distance in distances_by_transport_type %}
{{ transport_type | title }} distance: {{ "{:,.0f} km / {:,.0f} miles".format(distance, distance / 1.60934) }}
{% endfor %} {% endif %} {{ conference_list(trip) }} {% for day, elements in trip.elements_grouped_by_day() %}

{{ display_date_no_year(day) }}

{% set accommodation_label = {"check-in": "check-in from", "check-out": "check-out by"} %} {% for e in elements %} {% if e.element_type in accommodation_label %} {% set c = get_country(e.detail.country) %}
{{ e.get_emoji() }} {{ e.title }} {{ c.flag }} ({{ accommodation_label[e.element_type] }} {{ display_time(e.when) }})
{% else %}
{{ e.get_emoji() }} {{ display_time(e.when) }} – {{ e.title }} {% if e.element_type == "flight" %} airline: {{ e.detail.airline_name }} flight number: {{ e.detail.airline }}{{ e.detail.flight_number }} duration: {{ e.detail.duration }} {#
{{ e.detail | pprint }}
#} {% endif %}
{% endif %} {% endfor %} {% endfor %}
{% endfor %} {% endif %} {% endmacro %} {% macro conference_list(trip) %} {% for item in trip.conferences %} {% set country = get_country(item.country) if item.country else None %}
{{ item.name }} {{ display_date_no_year(item.start) }} to {{ display_date_no_year(item.end) }}

Topic: {{ item.topic }} | Venue: {{ item.venue }} | Location: {{ item.location }} {% if country %} {{ country.flag }} {% elif item.online %} 💻 Online {% else %} country code {{ item.country }} not found {% endif %} {% if item.free %} | free to attend {% elif item.price and item.currency %} | price: {{ item.price }} {{ item.currency }} {% endif %}

{% endfor %} {% endmacro %} {% block content %}
{{ section(heading, trips) }}
{% endblock %} {% block scripts %} {% endblock %}