Bug fix trip stats page

This commit is contained in:
Edward Betts 2024-12-12 20:47:21 +00:00
parent f6d715e52a
commit 77f0b17b37

View file

@ -31,20 +31,24 @@
{% endfor %}
</div>
<div>
Flight segments in {{ year }}: {{ year_stats.flight_count }}
Flight segments in {{ year }}: {{ year_stats.flight_count or 0 }}
{% if year_stats.airlines %}
[ by airline:
{% for airline, count in year_stats.airlines.most_common() %}
{{ airline }}: {{ count }}{% if not loop.last %},{% endif %}
{% endfor %} ]
{% for airline, count in year_stats.airlines.most_common() %}
{{ airline }}: {{ count }}{% if not loop.last %},{% endif %}
{% endfor %} ]
{% endif %}
</div>
<div>Trains segments in {{ year }}: {{ year_stats.train_count }}</div>
<div>Total distance in {{ year}}: {{ format_distance(year_stats.total_distance) }}</div>
<div>Trains segments in {{ year }}: {{ year_stats.train_count or 0 }}</div>
<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() %}
<div>
{{ transport_type | title }}
distance: {{format_distance(distance) }}
</div>
{% endfor %}
{% endif %}
{% endfor %}
</div>
{% endblock %}