Compare commits
No commits in common. "0079f46a80d47ed2082daf022b08341bd5c256cf" and "d5bf00491253be5dc95863d5858b2ce25d2fb795" have entirely different histories.
0079f46a80
...
d5bf004912
|
@ -7,7 +7,7 @@
|
|||
{% block title %}{{ heading }} - Edward Betts{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container-fluid">
|
||||
<div class="container">
|
||||
<h1>Trip statistics</h1>
|
||||
<div>Trips: {{ count }}</div>
|
||||
<div>Total distance: {{ format_distance(total_distance) }}</div>
|
||||
|
@ -25,11 +25,9 @@
|
|||
<div>Trips in {{ year }}: {{ year_stats.count }}</div>
|
||||
<div>{{ countries | count }} countries visited in {{ year }}:
|
||||
{% for c in countries %}
|
||||
<span class="text-nowrap">{{ c.flag }} {{ c.name }}</span>
|
||||
{{ c.flag }} {{ c.name }}
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div>Flights in {{ year }}: {{ year_stats.flight_count }}</div>
|
||||
<div>Trains in {{ year }}: {{ year_stats.train_count }}</div>
|
||||
<div>Total distance in {{ year}}: {{ format_distance(year_stats.total_distance) }}</div>
|
||||
{% for transport_type, distance in year_stats.distances_by_transport_type.items() %}
|
||||
<div>
|
||||
|
|
|
@ -547,13 +547,6 @@ def calculate_yearly_stats(trips: list[Trip]) -> dict[int, StrDict]:
|
|||
for country in trip.countries:
|
||||
yearly_stats[year].setdefault("countries", set())
|
||||
yearly_stats[year]["countries"].add(country)
|
||||
for leg in trip.travel:
|
||||
if leg["type"] == "flight":
|
||||
yearly_stats[year].setdefault("flight_count", 0)
|
||||
yearly_stats[year]["flight_count"] += 1
|
||||
if leg["type"] == "train":
|
||||
yearly_stats[year].setdefault("train_count", 0)
|
||||
yearly_stats[year]["train_count"] += 1
|
||||
return dict(yearly_stats)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue