Update trip statistics CO2 display with transport breakdown
- Change label from "Flight CO₂" to "Total CO₂" for accuracy - Add CO₂ breakdown by transport type (flight/train/ferry) - Show values in kg for <1000kg, tonnes for ≥1000kg - Track CO₂ emissions by transport type in stats calculation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
5a15f48f50
commit
06a7d03404
2 changed files with 23 additions and 1 deletions
|
|
@ -45,7 +45,25 @@
|
|||
{% endif %}
|
||||
</div>
|
||||
{% if year_stats.co2_kg %}
|
||||
<div>Flight CO₂: {{ "{:,.1f}".format(year_stats.co2_kg / 1000.0) }} tonnes</div>
|
||||
<div>Total CO₂:
|
||||
{% if year_stats.co2_kg >= 1000 %}
|
||||
{{ "{:,.2f}".format(year_stats.co2_kg / 1000.0) }} tonnes
|
||||
{% else %}
|
||||
{{ "{:,.0f}".format(year_stats.co2_kg) }} kg
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if year_stats.co2_by_transport_type %}
|
||||
{% for transport_type, co2_kg in year_stats.co2_by_transport_type.items() %}
|
||||
<div style="margin-left: 20px;">
|
||||
{{ transport_type | title }} CO₂:
|
||||
{% if co2_kg >= 1000 %}
|
||||
{{ "{:,.2f}".format(co2_kg / 1000.0) }} tonnes
|
||||
{% else %}
|
||||
{{ "{:,.0f}".format(co2_kg) }} kg
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<div>Trains segments in {{ year }}: {{ year_stats.train_count or 0 }}</div>
|
||||
<div>Total distance in {{ year}}: {{ format_distance(year_stats.total_distance or 0) }}</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue