{% extends "layout.html" %} {% block body %}
{% for vehicle in current_user.vehicles %}

{{vehicle.name}}

{% if vehicle.pitstops %}
{% for pitstop in vehicle.pitstops|reverse %} {% if not loop.last %} {% set days = (pitstop.date - vehicle.pitstops[vehicle.pitstops|length - loop.index - 1].date).days %} {% set distance = pitstop.odometer - vehicle.pitstops[vehicle.pitstops|length - loop.index - 1].odometer %} {% set average = (pitstop.litres / distance) * 100 %} {% if loop.first %} {% endif %} {% else %} {% endif %} {% endfor %}
Date
Days
Odometer
Distance
Litres
Average
Costs
Costs per Litre
{{pitstop.date}}
{{ days }} days
{{pitstop.odometer}} km
{{distance}} km
{{pitstop.litres}} l
{{average | round(2)}} l/100km
{{pitstop.costs}} €
{{ (pitstop.costs / pitstop.litres) | round(2) }} €/l
edit delete
{{pitstop.date}}
-- days
{{pitstop.odometer}} km
-- km
{{pitstop.litres}} l
-- l/100km
{{pitstop.costs}} €
{{ (pitstop.costs / pitstop.litres) | round(2) }} €/l
{% else %} {% endif %}
{% endfor %}
{% endblock %}