From fede777e9bf31d3ae93b2c9c38dc2e914dac5359 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Wed, 7 Jul 2021 09:37:21 -0700 Subject: [PATCH] Hide deleted status counts from book page --- bookwyrm/templates/book/book.html | 8 ++++---- bookwyrm/views/books.py | 9 +++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/bookwyrm/templates/book/book.html b/bookwyrm/templates/book/book.html index 26bd8322c..d721d4fd5 100644 --- a/bookwyrm/templates/book/book.html +++ b/bookwyrm/templates/book/book.html @@ -209,24 +209,24 @@ diff --git a/bookwyrm/views/books.py b/bookwyrm/views/books.py index a4b9f312a..492d0cac4 100644 --- a/bookwyrm/views/books.py +++ b/bookwyrm/views/books.py @@ -59,7 +59,7 @@ class Book(View): queryset = book.comment_set else: queryset = book.quotation_set - queryset = queryset.filter(user=request.user) + queryset = queryset.filter(user=request.user, deleted=False) else: queryset = reviews.exclude(Q(content__isnull=True) | Q(content="")) queryset = queryset.select_related("user") @@ -102,10 +102,11 @@ class Book(View): book__parent_work=book.parent_work, ).select_related("shelf", "book") + filters = {"user": request.user, "deleted": False} data["user_statuses"] = { - "review_count": book.review_set.filter(user=request.user).count(), - "comment_count": book.comment_set.filter(user=request.user).count(), - "quotation_count": book.quotation_set.filter(user=request.user).count(), + "review_count": book.review_set.filter(**filters).count(), + "comment_count": book.comment_set.filter(**filters).count(), + "quotation_count": book.quotation_set.filter(**filters).count(), } return TemplateResponse(request, "book/book.html", data)