{{collection.title}}
{% for region_group in records|groupby('region') %}
{{ region_group.grouper }}
{% for country_group in region_group.list|groupby('country') %} {% for period_group in country_group.list|groupby('period') %}
{{ country_group.grouper }} • {{ period_group.grouper }}
{%- set max_mint_count = namespace(value=0) %} {%- for year_group in period_group.list|groupby('year') %} {%- set mint_count = year_group.list|groupby('mintmark')|length %} {%- if mint_count > max_mint_count.value %} {%- set max_mint_count.value = mint_count %} {%- endif %} {%- endfor %} {%- if max_mint_count.value > 1 %} {%- endif %} {%- for unit_group in period_group.list|groupby('unit') %} {%- for value_group in unit_group.list|rejectattr('value_raw','string')|groupby('value_raw') %} {%- endfor %} {%- endfor %} {%- for years_group in period_group.list|groupby('year')|reverse %} {%- set total_variety_count = namespace(value=0) %} {%- for mints_group in years_group.list|groupby('mintmark') %} {%- set max_variety_count = namespace(value=0) %} {%- for unit_group in mints_group.list|groupby('unit') %} {%- for value_group in unit_group.list|groupby('value') %} {%- set variety_count = value_group.list|groupby('variety')|length %} {%- if variety_count > max_variety_count.value %} {%- set max_variety_count.value = variety_count %} {%- endif %} {%- endfor %} {%- endfor %} {%- set total_variety_count.value = total_variety_count.value + max_variety_count.value %} {%- endfor %} {%- for mints_group in years_group.list|groupby('mintmark') %} {%- set mints_loop = loop %} {%- set max_variety_count = namespace(value=0) %} {%- for unit_group in mints_group.list|groupby('unit') %} {%- for value_group in unit_group.list|groupby('value') %} {%- set variety_count = value_group.list|groupby('variety')|length %} {%- if variety_count > max_variety_count.value %} {%- set max_variety_count.value = variety_count %} {%- endif %} {%- endfor %} {%- endfor %} {%- for n in range(max_variety_count.value) %} {%- if loop.first %} {%- if mints_loop.first %} {%- endif %} {%- if max_mint_count.value > 1 %} {%- endif %} {%- endif %} {%- for unit_group in period_group.list|groupby('unit') %} {%- for value_group in unit_group.list|rejectattr('value_raw','string')|groupby('value_raw') %} {%- set coins_group = value_group.list | selectattr("year", "equalto", years_group.grouper) | list | selectattr("mintmark", "equalto", mints_group.grouper) | list %} {%- for variety_group in coins_group|groupby('variety') %} {%- if loop.index0 == n %} {%- set coins_group_owned = variety_group.list | selectattr("status_raw", "in", ('owned', 'ordered', 'sale', 'duplicate', 'replacement')) | list %} {%- if coins_group_owned | length %} {%- else %} {%- endif %} {%- endif %} {%- else %} {%- if n == 0 %} {%- endif %} {%- endfor %} {%- endfor %} {%- endfor %} {%- endfor %} {%- endfor %} {%- endfor %}
{{titles.year}}{{titles.mintmark}}{{ value_group.grouper }}{{ unit_group.grouper[0] }}
{{ years_group.grouper }}{{ mints_group.grouper }} {{ coins_group_owned | length }} {% if loop.length > 1 %}({{ variety_group.grouper }}){% endif %} {%- if loop.length > 1 %}({{ variety_group.grouper }}){% endif %} -

{% if not loop.last %}

{% endif %} {% endfor %} {% endfor %} {% endfor %}