Hide GB from countries visited on trip stats
This commit is contained in:
parent
b38ec99628
commit
efae1b9b14
|
@ -392,13 +392,17 @@ def calculate_yearly_stats(trips: list[Trip]) -> dict[int, StrDict]:
|
||||||
yearly_stats[year]["total_distance"] = (
|
yearly_stats[year]["total_distance"] = (
|
||||||
yearly_stats[year].get("total_distance", 0) + trip.total_distance()
|
yearly_stats[year].get("total_distance", 0) + trip.total_distance()
|
||||||
)
|
)
|
||||||
|
|
||||||
for transport_type, distance in trip.distances_by_transport_type():
|
for transport_type, distance in trip.distances_by_transport_type():
|
||||||
yearly_stats[year].setdefault("distances_by_transport_type", {})
|
yearly_stats[year].setdefault("distances_by_transport_type", {})
|
||||||
yearly_stats[year]["distances_by_transport_type"][transport_type] = (
|
yearly_stats[year]["distances_by_transport_type"][transport_type] = (
|
||||||
yearly_stats[year]["distances_by_transport_type"].get(transport_type, 0)
|
yearly_stats[year]["distances_by_transport_type"].get(transport_type, 0)
|
||||||
+ distance
|
+ distance
|
||||||
)
|
)
|
||||||
|
|
||||||
for country in trip.countries:
|
for country in trip.countries:
|
||||||
|
if country.alpha_2 == "GB":
|
||||||
|
continue
|
||||||
yearly_stats[year].setdefault("countries", set())
|
yearly_stats[year].setdefault("countries", set())
|
||||||
yearly_stats[year]["countries"].add(country)
|
yearly_stats[year]["countries"].add(country)
|
||||||
for leg in trip.travel:
|
for leg in trip.travel:
|
||||||
|
|
Loading…
Reference in a new issue