mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-22 16:16:39 +00:00
Use accurate review count
This commit is contained in:
parent
a0a8ad508a
commit
8301bec4ff
2 changed files with 2 additions and 1 deletions
|
@ -89,7 +89,7 @@
|
||||||
|
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<div class="block">
|
<div class="block">
|
||||||
<h3 class="field is-grouped">{% include 'snippets/stars.html' with rating=rating %} ({{ reviews|length }} review{{ reviews|length|pluralize }})</h3>
|
<h3 class="field is-grouped">{% include 'snippets/stars.html' with rating=rating %} ({{ review_count }} review{{ reviews|length|pluralize }})</h3>
|
||||||
|
|
||||||
{% include 'snippets/trimmed_text.html' with full=book|book_description %}
|
{% include 'snippets/trimmed_text.html' with full=book|book_description %}
|
||||||
|
|
||||||
|
|
|
@ -670,6 +670,7 @@ def book_page(request, book_id):
|
||||||
'title': book.title,
|
'title': book.title,
|
||||||
'book': book,
|
'book': book,
|
||||||
'reviews': reviews_page,
|
'reviews': reviews_page,
|
||||||
|
'review_count': reviews.count(),
|
||||||
'ratings': reviews.filter(Q(content__isnull=True) | Q(content='')),
|
'ratings': reviews.filter(Q(content__isnull=True) | Q(content='')),
|
||||||
'rating': reviews.aggregate(Avg('rating'))['rating__avg'],
|
'rating': reviews.aggregate(Avg('rating'))['rating__avg'],
|
||||||
'tags': models.UserTag.objects.filter(book=book),
|
'tags': models.UserTag.objects.filter(book=book),
|
||||||
|
|
Loading…
Reference in a new issue