Show CO₂ for flights on trip list.

This commit is contained in:
Edward Betts 2025-05-26 10:07:37 -05:00
parent a66565a785
commit 63c7c54bfc
4 changed files with 21 additions and 3 deletions

View file

@ -143,7 +143,7 @@
{{ "{:,.0f} km / {:,.0f} miles".format(item.distance, item.distance / 1.60934) }}
{% endif %}
</div>
<div class="grid-item text-end">{{ item.co2_kg }} kg</div>
<div class="grid-item text-end">{{ "{:,.1f}".format(item.co2_kg) }} kg</div>
{% endfor %}
{% endmacro %}
@ -307,6 +307,7 @@
{% macro trip_item(trip) %}
{% set distances_by_transport_type = trip.distances_by_transport_type() %}
{% set total_distance = trip.total_distance() %}
{% set total_co2_kg = trip.total_co2_kg() %}
{% set end = trip.end %}
<div class="border border-2 rounded mb-2 p-2">
<h3>
@ -336,6 +337,7 @@
</div>
{% endif %}
{% if distances_by_transport_type %}
{% for transport_type, distance in distances_by_transport_type %}
<div>
@ -345,6 +347,10 @@
{% endfor %}
{% endif %}
{% if total_co2_kg %}
<div>Total CO₂: {{ "{:,.1f}".format(total_co2_kg) }} kg</div>
{% endif %}
{{ conference_list(trip) }}
{% for day, elements in trip.elements_grouped_by_day() %}
@ -382,6 +388,7 @@
<span class="text-nowrap"><strong>duration:</strong> {{ e.detail.duration }}</span>
{% endif %}
{# <pre>{{ e.detail | pprint }}</pre> #}
<span class="text-nowrap"><strong>CO₂:</strong> {{ "{:,.1f}".format(e.detail.co2_kg) }} kg</span>
{% endif %}
{% if e.detail.distance %}
<span class="text-nowrap"><strong>distance:</strong> {{ format_distance(e.detail.distance) }}</span>