Add overall airline, airport, and station stats to trip summary

Aggregate yearly stats into overall totals so the trip stats page
shows flight segments by airline, airports used, and stations used
in the summary section at the top.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Edward Betts 2026-02-03 09:25:10 +00:00
parent bc5e595bb0
commit 523dc78b35
4 changed files with 59 additions and 0 deletions

View file

@ -20,6 +20,36 @@
</div>
{% endfor %}
<div>
Flight segments: {{ overall_stats.flight_count }}
{% if overall_stats.airlines %}
({{ overall_stats.airlines | count }} airlines)
[ by airline:
{% for airline, count in overall_stats.airlines.most_common() %}
{{ airline }}: {{ count }}{% if not loop.last %},{% endif %}
{% endfor %} ]
{% endif %}
</div>
{% if overall_stats.airports %}
<div>
Airports used: {{ overall_stats.airports | count }}
[ by airport:
{% for airport, count in overall_stats.airports.most_common() %}
{{ airport }}: {{ count }}{% if not loop.last %},{% endif %}
{% endfor %} ]
</div>
{% endif %}
<div>Train segments: {{ overall_stats.train_count }}</div>
{% if overall_stats.stations %}
<div>
Stations used: {{ overall_stats.stations | count }}
[ by station:
{% for station, count in overall_stats.stations.most_common() %}
{{ station }}: {{ count }}{% if not loop.last %},{% endif %}
{% endfor %} ]
</div>
{% endif %}
{% 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([]) %}