From efae1b9b147c196c713092eea63868ac4bdabd28 Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Wed, 10 Jul 2024 19:28:07 +0100 Subject: [PATCH] Hide GB from countries visited on trip stats --- agenda/trip.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/agenda/trip.py b/agenda/trip.py index 6d34c6c..f5557ea 100644 --- a/agenda/trip.py +++ b/agenda/trip.py @@ -392,13 +392,17 @@ def calculate_yearly_stats(trips: list[Trip]) -> dict[int, StrDict]: yearly_stats[year]["total_distance"] = ( yearly_stats[year].get("total_distance", 0) + trip.total_distance() ) + for transport_type, distance in trip.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"].get(transport_type, 0) + distance ) + for country in trip.countries: + if country.alpha_2 == "GB": + continue yearly_stats[year].setdefault("countries", set()) yearly_stats[year]["countries"].add(country) for leg in trip.travel: