From 1a2bd59f2345b53040e046eb800fd421bf635e66 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Mon, 4 Jan 2021 13:45:43 -0800 Subject: [PATCH] Fix accuracy of Descendants count on tags page. --- frontends/etiquette_flask/backend/endpoints/tag_endpoints.py | 3 ++- frontends/etiquette_flask/templates/tags.html | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/frontends/etiquette_flask/backend/endpoints/tag_endpoints.py b/frontends/etiquette_flask/backend/endpoints/tag_endpoints.py index 577fdc3..8ca6701 100644 --- a/frontends/etiquette_flask/backend/endpoints/tag_endpoints.py +++ b/frontends/etiquette_flask/backend/endpoints/tag_endpoints.py @@ -91,7 +91,8 @@ def get_tags_html(specific_tag_name=None): tag_count = common.P.get_tag_count() else: 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( 'easybake', diff --git a/frontends/etiquette_flask/templates/tags.html b/frontends/etiquette_flask/templates/tags.html index b4e89a4..7f1c168 100644 --- a/frontends/etiquette_flask/templates/tags.html +++ b/frontends/etiquette_flask/templates/tags.html @@ -142,7 +142,7 @@ h2, h3 {% if tags or not specific_tag %}
{% if specific_tag %} -

{{tag_count}} Descendants

+

{{tag_count - 1}} Descendants

{% else %}

{{tag_count}} Tags

{% endif %}