{% macro display_datetime(dt) %}{{ dt.strftime("%a, %d, %b %Y %H:%M %z") }}{% endmacro %} {% macro display_time(dt) %} {% if dt %}{{ dt.strftime("%H:%M %z") }}{% endif %} {% endmacro %} {% macro display_date(dt) %}{{ dt.strftime("%a %-d %b %Y") }}{% endmacro %} {% macro display_date_no_year(dt) %}{{ dt.strftime("%a %-d %b") }}{% endmacro %} {% macro display_conf_date_no_year(dt) %}{%- if dt.hour is defined %}{{ dt.strftime("%a %-d %b %H:%M") }}{% else %}{{ dt.strftime("%a %-d %b") }}{% endif %}{% endmacro %} {% macro format_distance(distance) %} {{ "{:,.0f} km / {:,.0f} miles".format(distance, distance / 1.60934) }} {% endmacro %} {% macro trip_link(trip) %} {{ trip.title }} {% endmacro %} {% macro conference_row(item, badge, show_flags=True) %} {% set country = get_country(item.country) if item.country else None %}
{{ item.start.strftime("%a, %d %b %Y") }}
{{ item.end.strftime("%a, %d %b") }}
{% if item.url %} {{ item.name }} {% else %} {{ item.name }} {% endif %} {% if item.going and not (item.accommodation_booked or item.travel_booked) %} {{ badge }} {% endif %} {% if item.accommodation_booked %} accommodation {% endif %} {% if item.transport_booked %} transport {% endif %}
{% if item.price and item.currency %} {{ "{:,d}".format(item.price | int) }} {{ item.currency }} {% if item.currency != "GBP" and item.currency in fx_rate %} {{ "{:,.2f}".format(item.price / fx_rate[item.currency]) }} GBP {% endif %} {% elif item.free %} free to attend {% endif %}
{{ item.topic }}
{{ item.location }}
{{ display_date(item.cfp_end) if item.cfp_end else "" }}
{% if country %} {% if show_flags %}{{ country.flag }}{% endif %} {{ country.name }} {% elif item.online %} ๐Ÿ’ป Online {% else %} country code {{ item.country }} not found {% endif %}
{% endmacro %} {% macro accommodation_row(item, badge, show_flags=True) %} {% set country = get_country(item.country) %} {% set nights = (item.to.date() - item.from.date()).days %}
{{ item.from.strftime("%a, %d %b %Y") }}
{{ item.to.strftime("%a, %d %b") }}
{% if nights == 1 %}1 night{% else %}{{ nights }} nights{% endif %}
{{ item.operator }}
{{ item.location }}
{% if country %} {% if show_flags %}{{ country.flag }}{% endif %} {{ country.name }} {% else %} country code {{ item.country }} not found {% endif %}
{% if g.user.is_authenticated and item.url %} {{ item.name }} {% else %} {{ item.name }} {% endif %}
{% if g.user.is_authenticated and item.price and item.currency %} {{ "{:,f}".format(item.price) }} {{ item.currency }} {% if item.currency != "GBP" %} {{ "{:,.2f}".format(item.price / fx_rate[item.currency]) }} GBP {% endif %} {% endif %}
{% endmacro %} {% macro flightradar24_url(flight) -%} https://www.flightradar24.com/data/flights/{{ flight.airline_detail.iata | lower + flight.flight_number }} {%- endmacro %} {% macro flight_booking_row(booking, show_flags=True) %}
{% if g.user.is_authenticated %} {{ booking.booking_reference or "reference missing" }} {% else %} redacted {% endif %}
{% if g.user.is_authenticated and booking.price and booking.currency %} {{ "{:,f}".format(booking.price) }} {{ booking.currency }} {% if booking.currency != "GBP" %} {{ "{:,.2f}".format(booking.price / fx_rate[booking.currency]) }} GBP {% endif %} {% endif %}
{% for i in range(9) %}
{% endfor %} {% for item in booking.flights %} {% set full_flight_number = item.airline_code + item.flight_number %} {% set radarbox_url = "https://www.radarbox.com/data/flights/" + full_flight_number %}
{{ item.depart.strftime("%a, %d %b %Y") }}
{{ item.from }} โ†’ {{ item.to }}
{{ item.depart.strftime("%H:%M") }}
{% if item.arrive %} {{ item.arrive.strftime("%H:%M") }} {% if item.arrive.date() != item.depart.date() %}+1 day{% endif %} {% endif %}
{{ item.duration }}
{{ full_flight_number }}
flightradar24 | FlightAware | radarbox
{% if item.distance %} {{ "{:,.0f} km / {:,.0f} miles".format(item.distance, item.distance / 1.60934) }} {% endif %}
{{ "{:,.1f}".format(item.co2_kg) }} kg
{% endfor %} {% endmacro %} {% macro flight_row(item) %} {% set full_flight_number = item.airline_code + item.flight_number %} {% set radarbox_url = "https://www.radarbox.com/data/flights/" + full_flight_number %}
{{ item.depart.strftime("%a, %d %b %Y") }}
{{ item.from }} โ†’ {{ item.to }}
{{ item.depart.strftime("%H:%M") }}
{% if item.arrive %} {{ item.arrive.strftime("%H:%M") }} {% if item.arrive.date() != item.depart.date() %}+1 day{% endif %} {% endif %}
{{ item.duration }}
{{ full_flight_number }}
{% if g.user.is_authenticated %} {{ item.booking_reference }} {% else %} redacted {% endif %}
flightradar24 | FlightAware | radarbox
{% if item.distance %} {{ "{:,.0f} km / {:,.0f} miles".format(item.distance, item.distance / 1.60934) }} {% endif %}
{% if g.user.is_authenticated and item.price and item.currency %} {{ "{:,f}".format(item.price) }} {{ item.currency }} {% if item.currency != "GBP" %} {{ "{:,.2f}".format(item.price / fx_rate[item.currency]) }} GBP {% endif %} {% endif %}
{% endmacro %} {% macro train_row(item) %} {% set url = item.url %}
{{ item.depart.strftime("%a, %d %b %Y") }}
{% if g.user.is_authenticated and item.url %}{% endif %} {{ item.from }} โ†’ {{ item.to }} {% if g.user.is_authenticated and item.url %}{% endif %}
{{ item.depart.strftime("%H:%M") }}
{% if item.arrive %} {{ item.arrive.strftime("%H:%M") }} {% if item.depart != item.arrive and item.arrive.date() != item.depart.date() %}+1 day{% endif %} {% endif %}
{{ ((item.arrive - item.depart).total_seconds() // 60) | int }} mins
{{ item.operator }}
{% if g.user.is_authenticated %} {{ item.booking_reference }} {% else %} redacted {% endif %}
{% for leg in item.legs %} {% if leg.url %} [{{ loop.index }}] {% endif %} {% endfor %}
{% if item.distance %} {{ "{:,.0f} km / {:,.0f} miles".format(item.distance, item.distance / 1.60934) }} {% endif %}
{% if g.user.is_authenticated and item.price and item.currency %} {{ "{:,f}".format(item.price) }} {{ item.currency }} {% if item.currency != "GBP" and item.currency in fx_rate %} {{ "{:,.2f}".format(item.price / fx_rate[item.currency]) }} GBP {% endif %} {% endif %}
{% endmacro %} {% macro coach_row(item) %} {% set url = item.url %}
{{ item.depart.strftime("%a, %d %b %Y") }}
{% if g.user.is_authenticated and item.url %}{% endif %} {{ item.from }} โ†’ {{ item.to }} {% if g.user.is_authenticated and item.url %}{% endif %}
{{ item.depart.strftime("%H:%M") }}
{% if item.arrive %} {{ item.arrive.strftime("%H:%M") }} {% if item.depart != item.arrive and item.arrive.date() != item.depart.date() %}+1 day{% endif %} {% endif %}
{{ ((item.arrive - item.depart).total_seconds() // 60) | int }} mins
{{ item.operator }}
{% if g.user.is_authenticated %} {{ item.booking_reference }} {% else %} redacted {% endif %}
{% if item.distance %} {{ "{:,.0f} km / {:,.0f} miles".format(item.distance, item.distance / 1.60934) }} {% endif %}
{% if g.user.is_authenticated and item.price and item.currency %} {{ "{:,f}".format(item.price) }} {{ item.currency }} {% if item.currency != "GBP" and item.currency in fx_rate %} {{ "{:,.2f}".format(item.price / fx_rate[item.currency]) }} GBP {% endif %} {% endif %}
{% endmacro %} {% macro bus_row(item) %} {% set url = item.url %}
{{ item.depart.strftime("%a, %d %b %Y") }}
{% if g.user.is_authenticated and item.url %}{% endif %} {{ item.from }} โ†’ {{ item.to }} {% if g.user.is_authenticated and item.url %}{% endif %}
{{ item.depart.strftime("%H:%M") }}
{% if item.arrive %} {{ item.arrive.strftime("%H:%M") }} {% if item.depart != item.arrive and item.arrive.date() != item.depart.date() %}+1 day{% endif %} {% endif %}
{{ ((item.arrive - item.depart).total_seconds() // 60) | int }} mins
{{ item.operator }}
{% if g.user.is_authenticated %} {{ item.booking_reference }} {% else %} redacted {% endif %}
{% if item.distance %} {{ "{:,.0f} km / {:,.0f} miles".format(item.distance, item.distance / 1.60934) }} {% endif %}
{% if g.user.is_authenticated and item.price and item.currency %} {{ "{:,f}".format(item.price) }} {{ item.currency }} {% if item.currency != "GBP" and item.currency in fx_rate %} {{ "{:,.2f}".format(item.price / fx_rate[item.currency]) }} GBP {% endif %} {% endif %}
{% endmacro %} {% macro ferry_row(item) %}
{{ item.depart.strftime("%a, %d %b %Y") }}
{{ item.from }} โ†’ {{ item.to }}
{{ item.depart.strftime("%H:%M") }}
{% if item.arrive %} {{ item.arrive.strftime("%H:%M") }} {% if item.depart != item.arrive and item.arrive.date() != item.depart.date() %}+1 day{% endif %} {% endif %}
{{ item.operator }}
{% if g.user.is_authenticated and item.price and item.currency %} {{ "{:,f}".format(item.price) }} {{ item.currency }} {% if item.currency != "GBP" %} {{ "{:,.2f}".format(item.price / fx_rate[item.currency]) }} GBP {% endif %} {% endif %}
{#
{{ item | pprint }}
#} {% endmacro %} {% macro flag(trip, flag) %}{% if trip.show_flags %}{{ flag }}{% 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_conf_date_no_year(item.attend_start if item.attend_start else item.start) }} to {{ display_conf_date_no_year(item.attend_end if item.attend_end else item.end) }} {% if item.attend_start or item.attend_end %} (full conference: {{ display_date_no_year(item.start) }} to {{ display_date_no_year(item.end) }}) {% endif %}

Topic: {{ item.topic }} | Venue: {{ item.venue }} | Location: {{ item.location }} {% if country %} {{ flag(trip, 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 %} {% macro render_trip_element(e, trip) %} {% set item = e.detail %} {% if e.element_type == "check-in" %} {% set nights = (item.to.date() - item.from.date()).days %}
{{ e.get_emoji() }} {{ item.name }} {% if item.operator and item.operator != item.name %}{{ item.operator }}{% endif %} ({% if nights == 1 %}1 night{% else %}{{ nights }} nights{% endif %})
{% elif e.element_type == "check-out" %}
{{ e.get_emoji() }} Check out: {{ item.name }} {% if item.operator and item.operator != item.name %}{{ item.operator }}{% endif %}
{% elif e.element_type != "conference" %} {# Transport: flight, train, ferry, coach, bus #} {% set has_arrive = item.arrive is defined and item.arrive %} {# item.depart may be a date (no .date() method) or a datetime (has .date()) #} {% set has_time = item.depart is defined and item.depart and item.depart.hour is defined %} {% set depart_date = item.depart.date() if has_time else item.depart %} {% set arrive_date = item.arrive.date() if (has_arrive and item.arrive.hour is defined) else item.arrive %} {% set is_overnight = has_arrive and depart_date != arrive_date %} {% set dur_mins = ((item.arrive - item.depart).total_seconds() // 60) | int if (has_time and has_arrive) else none %}
{% if is_overnight %}๐ŸŒ™{% else %}{{ e.get_emoji() }}{% endif %} {{ e.start_loc }} โ†’ {{ e.end_loc }} {% if has_time %} ยท {{ item.depart.strftime("%H:%M") }}{% if has_arrive and item.arrive.hour is defined %} โ†’ {{ item.arrive.strftime("%H:%M") }}{% if is_overnight %} +1 day{% endif %}{% endif %} {% endif %} {% if dur_mins %} {%- set h = dur_mins // 60 %}{%- set m = dur_mins % 60 %} ๐Ÿ•’{% if h %}{{ h }}h {% endif %}{% if m %}{{ m }}m{% endif %} {% endif %} {% if e.element_type == "flight" %} ยท {{ item.airline_name }} {{ item.airline_code }}{{ item.flight_number }} {% elif item.operator %} ยท {{ item.operator }} {% endif %} {% if item.distance %} ยท {{ "{:,.0f} km".format(item.distance) }} {% endif %} {% if item.co2_kg is defined and item.co2_kg is not none %} COโ‚‚ {{ "{:,.1f}".format(item.co2_kg) }} kg {% endif %}
{% endif %} {% endmacro %} {% macro trip_item(trip) %} {% set distances_by_transport_type = trip.distances_by_transport_type() %} {% set total_distance = trip.total_distance() %} {% set total_co2_kg = trip.total_co2_kg() %} {% set end = trip.end %} {% set trip_end = end or trip.start %} {% set is_current = trip.start <= today and trip_end >= today %}

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

{% set school_holidays = trip_school_holiday_map.get(trip.start.isoformat(), []) if trip_school_holiday_map is defined else [] %} {% if school_holidays %}
UK school holiday {% for item in school_holidays %} {{ item.title }} ({{ display_date_no_year(item.as_date) }} to {{ display_date_no_year(item.end_as_date) }}) {% endfor %}
{% endif %} {% if end %}
Dates: {{ display_date_no_year(trip.start) }} to {{ display_date_no_year(end) }} {% if g.user.is_authenticated and trip.start <= today %} photos {% endif %}
{% else %}
Start: {{ display_date_no_year(trip.start) }} (end date missing)
{% endif %}
{% if total_distance %} {{ format_distance(total_distance) }} {% endif %} {% if distances_by_transport_type %} {% for transport_type, distance in distances_by_transport_type %} {{ transport_type | title }}: {{format_distance(distance) }} {% endfor %} {% endif %} {% if total_co2_kg %} COโ‚‚ {{ "{:,.1f}".format(total_co2_kg) }} kg {% endif %} {% set co2_by_transport = trip.co2_by_transport_type() %} {% if co2_by_transport %} {% for transport_type, co2_kg in co2_by_transport %} {{ transport_type | title }} COโ‚‚ {{ "{:,.1f}".format(co2_kg) }} kg {% endfor %} {% endif %}
{% if trip.schengen_compliance %}
Schengen: {% if trip.schengen_compliance.is_compliant %} โœ… Compliant {% else %} โŒ Non-compliant {% endif %} ({{ trip.schengen_compliance.total_days_used }}/90 days used)
{% endif %} {{ conference_list(trip) }} {% set trip_weather = trip_weather_map.get(trip.start.isoformat(), {}) if trip_weather_map is defined else {} %} {% for day, elements in trip.elements_grouped_by_day() %} {% set weather = trip_weather.get(day.isoformat()) %}

{{ display_date_no_year(day) }} {% if weather %} {{ weather.status }} {{ weather.temp_min }}โ€“{{ weather.temp_max }}ยฐC {{ weather.detailed_status }} {% endif %} {% if g.user.is_authenticated and day <= today %} photos {% endif %}

{% for e in elements %} {{ render_trip_element(e, trip) }} {% endfor %} {% endfor %}
{% endmacro %}