diff --git a/templates/trip/stats.html b/templates/trip/stats.html index 7d81a3d..8a117ef 100644 --- a/templates/trip/stats.html +++ b/templates/trip/stats.html @@ -31,24 +31,20 @@ {% endfor %}
- Flight segments in {{ year }}: {{ year_stats.flight_count or 0 }} - {% if year_stats.airlines %} + Flight segments in {{ year }}: {{ year_stats.flight_count }} [ by airline: - {% for airline, count in year_stats.airlines.most_common() %} - {{ airline }}: {{ count }}{% if not loop.last %},{% endif %} - {% endfor %} ] - {% endif %} + {% for airline, count in year_stats.airlines.most_common() %} + {{ airline }}: {{ count }}{% if not loop.last %},{% endif %} + {% endfor %} ]
-
Trains segments in {{ year }}: {{ year_stats.train_count or 0 }}
-
Total distance in {{ year}}: {{ format_distance(year_stats.total_distance or 0) }}
- {% if year_stats.distances_by_transport_type %} +
Trains segments in {{ year }}: {{ year_stats.train_count }}
+
Total distance in {{ year}}: {{ format_distance(year_stats.total_distance) }}
{% for transport_type, distance in year_stats.distances_by_transport_type.items() %}
{{ transport_type | title }} distance: {{format_distance(distance) }}
{% endfor %} - {% endif %} {% endfor %} {% endblock %} diff --git a/validate_yaml.py b/validate_yaml.py index 4e3ed1d..818840d 100755 --- a/validate_yaml.py +++ b/validate_yaml.py @@ -43,19 +43,13 @@ def check_trips() -> None: def check_flights(airlines: set[str]) -> None: - """Check flights and ensure they are in chronological order.""" + """Check flights.""" bookings = agenda.travel.parse_yaml("flights", data_dir) - - prev_first_depart = None for booking in bookings: assert all(flight["airline"] in airlines for flight in booking["flights"]) - check_currency(booking) - if prev_first_depart: - assert ( - booking["flights"][0]["depart"] > prev_first_depart - ), "Bookings are not in chronological order by first flight's departure." - prev_first_depart = booking["flights"][0]["depart"] + for booking in bookings: + check_currency(booking) print(len(bookings), "flights")