Swtich to including future travel in trip stats page
This commit is contained in:
parent
96ec2b7d89
commit
d2c6a778e3
15
web_view.py
15
web_view.py
|
@ -613,18 +613,19 @@ def trip_stats() -> str:
|
||||||
"""Travel stats: distance and price by year and travel type."""
|
"""Travel stats: distance and price by year and travel type."""
|
||||||
route_distances = agenda.travel.load_route_distances(app.config["DATA_DIR"])
|
route_distances = agenda.travel.load_route_distances(app.config["DATA_DIR"])
|
||||||
trip_list = get_trip_list(route_distances)
|
trip_list = get_trip_list(route_distances)
|
||||||
today = date.today()
|
|
||||||
|
|
||||||
past = [item for item in trip_list if (item.end or item.start) < today]
|
# today = date.today()
|
||||||
conferences = sum(len(item.conferences) for item in past)
|
# 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(
|
return flask.render_template(
|
||||||
"trip/stats.html",
|
"trip/stats.html",
|
||||||
count=len(past),
|
count=len(trip_list),
|
||||||
total_distance=calc_total_distance(past),
|
total_distance=calc_total_distance(trip_list),
|
||||||
distances_by_transport_type=sum_distances_by_transport_type(past),
|
distances_by_transport_type=sum_distances_by_transport_type(trip_list),
|
||||||
yearly_stats=yearly_stats,
|
yearly_stats=yearly_stats,
|
||||||
conferences=conferences,
|
conferences=conferences,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue