Fix accuracy of Descendants count on tags page.

This commit is contained in:
voussoir 2021-01-04 13:45:43 -08:00
parent 99218fa743
commit 1a2bd59f23
2 changed files with 3 additions and 2 deletions

View file

@ -91,7 +91,8 @@ def get_tags_html(specific_tag_name=None):
tag_count = common.P.get_tag_count() tag_count = common.P.get_tag_count()
else: else:
tags = specific_tag.get_children() tags = specific_tag.get_children()
tag_count = sum(1 for child in specific_tag.walk_children()) # Set because tags may have multiple lineages
tag_count = len(set(specific_tag.walk_children()))
tags = common.P.get_cached_tag_export( tags = common.P.get_cached_tag_export(
'easybake', 'easybake',

View file

@ -142,7 +142,7 @@ h2, h3
{% if tags or not specific_tag %} {% if tags or not specific_tag %}
<div id="hierarchy_tags" class="panel"> <div id="hierarchy_tags" class="panel">
{% if specific_tag %} {% if specific_tag %}
<h3>{{tag_count}} Descendants</h3> <h3>{{tag_count - 1}} Descendants</h3>
{% else %} {% else %}
<h2>{{tag_count}} Tags</h2> <h2>{{tag_count}} Tags</h2>
{% endif %} {% endif %}