Show new badge next to new countries on travel stats page.

This commit is contained in:
Edward Betts 2025-01-24 20:19:25 +01:00
parent 340905ecff
commit 2f574264e5
2 changed files with 7 additions and 1 deletions

View file

@ -27,7 +27,12 @@
<div>Conferences in {{ year }}: {{ year_stats.conferences }}</div> <div>Conferences in {{ year }}: {{ year_stats.conferences }}</div>
<div>{{ countries | count }} countries visited in {{ year }}: <div>{{ countries | count }} countries visited in {{ year }}:
{% for c in countries %} {% for c in countries %}
<span class="text-nowrap">{{ c.flag }} {{ c.name }}</span> <span class="text-nowrap border border-2 px-2 my-3 mx-1">
{{ c.flag }} {{ c.name }} ({{ c.alpha_2 }})
{% if c.alpha_2 not in previously_visited %}
<span class="badge text-bg-info">new</span>
{% endif %}
</span>
{% endfor %} {% endfor %}
</div> </div>
<div> <div>

View file

@ -580,6 +580,7 @@ def trip_stats() -> str:
distances_by_transport_type=sum_distances_by_transport_type(trip_list), distances_by_transport_type=sum_distances_by_transport_type(trip_list),
yearly_stats=yearly_stats, yearly_stats=yearly_stats,
conferences=conferences, conferences=conferences,
previously_visited=app.config.get("PREVIOUSLY_VISITED", set),
) )