43 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			43 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
{% extends "base.html" %}
 | 
						|
 | 
						|
{% from "macros.html" import format_distance with context %}
 | 
						|
 | 
						|
{% set heading = "Trip statistics" %}
 | 
						|
 | 
						|
{% block title %}{{ heading }} - Edward Betts{% endblock %}
 | 
						|
 | 
						|
{% block content %}
 | 
						|
<div class="container-fluid">
 | 
						|
  <h1>Trip statistics</h1>
 | 
						|
  <div>Trips: {{ count }}</div>
 | 
						|
  <div>Total distance: {{ format_distance(total_distance) }}</div>
 | 
						|
 | 
						|
  {% for transport_type, distance in distances_by_transport_type %}
 | 
						|
    <div>
 | 
						|
      {{ transport_type | title }}
 | 
						|
      distance: {{format_distance(distance) }}
 | 
						|
    </div>
 | 
						|
  {% endfor %}
 | 
						|
 | 
						|
  {% for year, year_stats in yearly_stats | dictsort %}
 | 
						|
    {% set countries = year_stats.countries | sort(attribute="name") %}
 | 
						|
    <h4>{{ year }}</h4>
 | 
						|
    <div>Trips in {{ year }}: {{ year_stats.count }}</div>
 | 
						|
    <div>{{ countries | count }} countries visited in {{ year }}:
 | 
						|
      {% for c in countries %}
 | 
						|
      <span class="text-nowrap">{{ c.flag }} {{ c.name }}</span>
 | 
						|
      {% endfor %}
 | 
						|
      </div>
 | 
						|
    <div>Flights in {{ year }}: {{ year_stats.flight_count }}</div>
 | 
						|
    <div>Trains in {{ year }}: {{ year_stats.train_count }}</div>
 | 
						|
    <div>Total distance in {{ year}}: {{ format_distance(year_stats.total_distance) }}</div>
 | 
						|
    {% for transport_type, distance in year_stats.distances_by_transport_type.items() %}
 | 
						|
      <div>
 | 
						|
        {{ transport_type | title }}
 | 
						|
        distance: {{format_distance(distance) }}
 | 
						|
      </div>
 | 
						|
    {% endfor %}
 | 
						|
  {% endfor %}
 | 
						|
</div>
 | 
						|
{% endblock %}
 |