From d2c6a778e35a530ae20b8b125cf6e6fc0605d674 Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Wed, 25 Sep 2024 12:16:42 +0100 Subject: [PATCH] Swtich to including future travel in trip stats page --- web_view.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/web_view.py b/web_view.py index 296c670..6944841 100755 --- a/web_view.py +++ b/web_view.py @@ -613,18 +613,19 @@ def trip_stats() -> str: """Travel stats: distance and price by year and travel type.""" route_distances = agenda.travel.load_route_distances(app.config["DATA_DIR"]) trip_list = get_trip_list(route_distances) - today = date.today() - past = [item for item in trip_list if (item.end or item.start) < today] - conferences = sum(len(item.conferences) for item in past) + # today = date.today() + # past = [item for item in trip_list if (item.end or item.start) < today] - yearly_stats = agenda.trip.calculate_yearly_stats(past) + conferences = sum(len(item.conferences) for item in trip_list) + + yearly_stats = agenda.trip.calculate_yearly_stats(trip_list) return flask.render_template( "trip/stats.html", - count=len(past), - total_distance=calc_total_distance(past), - distances_by_transport_type=sum_distances_by_transport_type(past), + count=len(trip_list), + total_distance=calc_total_distance(trip_list), + distances_by_transport_type=sum_distances_by_transport_type(trip_list), yearly_stats=yearly_stats, conferences=conferences, )