{% set ns = namespace(tag_counts={}) %}
{% for lg in level_groups %}
{% for card in lg.challenges %}
{% for tag in card.tags %}
{% if tag in ns.tag_counts %}
{% set _ = ns.tag_counts.update({tag: ns.tag_counts[tag] + 1}) %}
{% else %}
{% set _ = ns.tag_counts.update({tag: 1}) %}
{% endif %}
{% endfor %}
{% endfor %}
{% endfor %}
{% set all_tags = ns.tag_counts.items() | sort(attribute='1', reverse=true) %}
{% if all_tags %}
{% for tag, count in all_tags %}
{% endfor %}
{% if all_tags | length > 10 %}
{% endif %}
{% endif %}
{% set ns2 = namespace(cat_stats={}) %}
{% for lg in level_groups %}
{% for card in lg.challenges %}
{% if card.category %}
{% if card.category not in ns2.cat_stats %}
{% set _ = ns2.cat_stats.update({card.category: {'total': 0, 'enabled': 0}}) %}
{% endif %}
{% set _ = ns2.cat_stats[card.category].update({'total': ns2.cat_stats[card.category].total + 1}) %}
{% if card.enabled %}
{% set _ = ns2.cat_stats[card.category].update({'enabled': ns2.cat_stats[card.category].enabled + 1}) %}
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
{% if ns2.cat_stats %}
分类:
{% for cat, stats in ns2.cat_stats.items() | sort %}