{% extends "base.html" %} {% from "macros.html" import format_distance with context %} {% set heading = "Trip statistics" %} {% block title %}{{ heading }} - Edward Betts{% endblock %} {% macro stat_list(id, label, counter, show_top=5) %}
{{ label }}: {{ counter | count }} {% if counter | count > 0 %}
{% for item, count in counter.most_common() %} {{ item }} {{ count }} {% endfor %}
{% endif %}
{% endmacro %} {% block content %}

Trip statistics

Overall Summary
Trips: {{ count }}
Conferences: {{ conferences }}
Total distance: {{ format_distance(total_distance) }}
{% for transport_type, distance in distances_by_transport_type %}
{{ transport_type | title }}: {{ format_distance(distance) }}
{% endfor %}
Flight segments: {{ overall_stats.flight_count }}
Train segments: {{ overall_stats.train_count }}

{{ stat_list("overall-airlines", "Airlines", overall_stats.airlines) }} {{ stat_list("overall-airports", "Airports", overall_stats.airports) }} {{ stat_list("overall-stations", "Stations", overall_stats.stations) }}
{% for year, year_stats in yearly_stats | dictsort(reverse=True) %} {% set countries = year_stats.countries | default([]) | sort(attribute="name") %} {% set new_countries = year_stats.new_countries | default([]) %}
{{ year }} {{ year_stats.count }} trips
Trips: {{ year_stats.count }}
Conferences: {{ year_stats.conferences }}
Distance: {{ format_distance(year_stats.total_distance or 0) }}
{% if year_stats.distances_by_transport_type %} {% for transport_type, distance in year_stats.distances_by_transport_type.items() %}
{{ transport_type | title }}: {{ format_distance(distance) }}
{% endfor %} {% endif %}
Flight segments: {{ year_stats.flight_count or 0 }}
Train segments: {{ year_stats.train_count or 0 }}
{% if year_stats.co2_kg %}
CO₂: {% if year_stats.co2_kg >= 1000 %} {{ "{:,.2f}".format(year_stats.co2_kg / 1000.0) }} tonnes {% else %} {{ "{:,.0f}".format(year_stats.co2_kg) }} kg {% endif %}
{% endif %}
Countries: {{ countries | count }} {% if new_countries %}({{ new_countries | count }} new){% endif %}
{% for c in countries %} {{ c.flag }} {{ c.name }} {% if c in new_countries %} new {% endif %} {% endfor %}
{% if year_stats.airlines %} {{ stat_list("airlines-" ~ year, "Airlines", year_stats.airlines) }} {% endif %} {% if year_stats.airports %} {{ stat_list("airports-" ~ year, "Airports", year_stats.airports) }} {% endif %} {% if year_stats.stations %} {{ stat_list("stations-" ~ year, "Stations", year_stats.stations) }} {% endif %}
{% endfor %}
{% endblock %}