From 9b5f0c096923c9352d854745531693feb880aff7 Mon Sep 17 00:00:00 2001 From: cuom1999 Date: Tue, 7 Mar 2023 23:43:26 -0600 Subject: [PATCH] Optimize actionbar comment --- judge/comments.py | 1 + templates/actionbar/list.html | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/judge/comments.py b/judge/comments.py index 5ce4fa7..d99f11e 100644 --- a/judge/comments.py +++ b/judge/comments.py @@ -184,5 +184,6 @@ class CommentedDetailView(TemplateResponseMixin, SingleObjectMixin, View): ).exists() ) context["comment_list"] = queryset + context["comment_count"] = len(queryset) context["vote_hide_threshold"] = settings.DMOJ_COMMENT_VOTE_HIDE_THRESHOLD return context diff --git a/templates/actionbar/list.html b/templates/actionbar/list.html index 0bb2ef1..0bad8e1 100644 --- a/templates/actionbar/list.html +++ b/templates/actionbar/list.html @@ -27,9 +27,9 @@ {{_("Comment")}} - {% if comment_list.count() %} + {% if comment_count %} - ({{comment_list.count()}}) + ({{comment_count}}) {% endif %}