{% macro stats_panel(journal_entries, page, journal_count, has_gpx) %} {% set days_on_road = 0 %} {% if page.header.date_end is not empty %} {% set start_ts = page.header.date_start|date('U') %} {% set end_ts = page.header.date_end|date('U') %} {% set days_on_road = ((end_ts - start_ts) / 86400)|round(0, 'ceil') %} {% else %} {% set first_ts = null %} {% for entry in journal_entries %} {% set ts = entry.date|date('U') %} {% if first_ts is null or ts < first_ts %}{% set first_ts = ts %}{% endif %} {% endfor %} {% if first_ts is not null %} {% set diff_seconds = "now"|date('U') - first_ts %} {% set days_raw = (diff_seconds / 86400)|round(0, 'floor') %} {% set days_on_road = days_raw < 1 ? 1 : days_raw %} {% endif %} {% endif %} {% set seen_lower = [] %} {% set country_display = [] %} {% for entry in journal_entries %} {% if entry.header.location_country is not empty %} {% set lower = entry.header.location_country|trim|lower %} {% if lower not in seen_lower %} {% set seen_lower = seen_lower|merge([lower]) %} {% set country_display = country_display|merge([entry.header.location_country|trim]) %} {% endif %} {% endif %} {% endfor %} {% set seen_city_lower = [] %} {% set city_display = [] %} {% for entry in journal_entries %} {% if entry.header.location_city is not empty %} {% set lower = entry.header.location_city|trim|lower %} {% if lower not in seen_city_lower %} {% set seen_city_lower = seen_city_lower|merge([lower]) %} {% set city_display = city_display|merge([entry.header.location_city|trim]) %} {% endif %} {% endif %} {% endfor %} {% set temp_min = null %} {% set temp_max = null %} {% for entry in journal_entries %} {% if entry.header.weather_temp_c is defined and entry.header.weather_temp_c is not empty %} {% set t = entry.header.weather_temp_c %} {% if temp_min is null or t < temp_min %}{% set temp_min = t %}{% endif %} {% if temp_max is null or t > temp_max %}{% set temp_max = t %}{% endif %} {% endif %} {% endfor %}
{{ country_display|join(' · ') }}
{% endif %}{{ has_gpx ? 'Distance based on GPS track data.' : 'Distance is approximate — straight lines between entry locations.' }}