Add airline, airport, and station stats

This commit is contained in:
Edward Betts 2026-01-15 23:05:39 +00:00
parent f22772d12d
commit bc5e595bb0
2 changed files with 48 additions and 1 deletions

View file

@ -42,12 +42,22 @@
<div>
Flight segments in {{ year }}: {{ year_stats.flight_count or 0 }}
{% if year_stats.airlines %}
({{ year_stats.airlines | count }} airlines)
[ by airline:
{% for airline, count in year_stats.airlines.most_common() %}
{{ airline }}: {{ count }}{% if not loop.last %},{% endif %}
{% endfor %} ]
{% endif %}
</div>
{% if year_stats.airports %}
<div>
Airports used in {{ year }}: {{ year_stats.airports | count }}
[ by airport:
{% for airport, count in year_stats.airports.most_common() %}
{{ airport }}: {{ count }}{% if not loop.last %},{% endif %}
{% endfor %} ]
</div>
{% endif %}
{% if year_stats.co2_kg %}
<div>Total CO₂:
{% if year_stats.co2_kg >= 1000 %}
@ -70,6 +80,15 @@
{% endif %}
{% endif %}
<div>Trains segments in {{ year }}: {{ year_stats.train_count or 0 }}</div>
{% if year_stats.stations %}
<div>
Stations used in {{ year }}: {{ year_stats.stations | count }}
[ by station:
{% for station, count in year_stats.stations.most_common() %}
{{ station }}: {{ count }}{% if not loop.last %},{% endif %}
{% endfor %} ]
</div>
{% endif %}
<div>Total distance in {{ year}}: {{ format_distance(year_stats.total_distance or 0) }}</div>
{% if year_stats.distances_by_transport_type %}
{% for transport_type, distance in year_stats.distances_by_transport_type.items() %}