Fix trip stats new-country counting
This commit is contained in:
parent
91a74fd887
commit
8a0df48a73
5 changed files with 61 additions and 18 deletions
|
|
@ -21,24 +21,25 @@
|
|||
{% endfor %}
|
||||
|
||||
{% for year, year_stats in yearly_stats | dictsort(reverse=True) %}
|
||||
{% set countries = year_stats.countries | sort(attribute="name") %}
|
||||
{% set countries = year_stats.countries | default([]) | sort(attribute="name") %}
|
||||
{% set new_countries = year_stats.new_countries | default([]) %}
|
||||
<h4>{{ year }}</h4>
|
||||
<div>Trips in {{ year }}: {{ year_stats.count }}</div>
|
||||
<div>Conferences in {{ year }}: {{ year_stats.conferences }}</div>
|
||||
<div>{{ countries | count }} countries visited in {{ year }}:
|
||||
{% set new_countries = [] %}
|
||||
{% for c in countries %}
|
||||
{% set display_new_countries = [] %}
|
||||
{% for c in new_countries %}
|
||||
{% if c.alpha_2 not in previously_visited %}
|
||||
{% set _ = new_countries.append(c) %}
|
||||
{% set _ = display_new_countries.append(c) %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if new_countries %}
|
||||
({{ new_countries | count }} new)
|
||||
{% if display_new_countries %}
|
||||
({{ display_new_countries | count }} new)
|
||||
{% endif %}
|
||||
{% for c in countries %}
|
||||
<span class="d-inline-block border border-2 p-1 m-1">
|
||||
{{ c.flag }} {{ c.name }} ({{ c.alpha_2 }})
|
||||
{% if c.alpha_2 not in previously_visited %}
|
||||
{% if c in display_new_countries %}
|
||||
<span class="badge text-bg-info">new</span>
|
||||
{% endif %}
|
||||
</span>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue