Fixes superlatives

This commit is contained in:
Mouse Reeve 2022-01-06 09:22:10 -08:00
parent 705f6d36a6
commit 840746754d
3 changed files with 8 additions and 8 deletions

View file

@ -21,7 +21,7 @@
</p>
<div class="columns">
<div class="column is-one-third">
<div class="column is-one-third is-flex">
<div class="media notification">
<div class="media-left">
<a href="{{ book.local_path }}">
@ -35,7 +35,7 @@
</div>
</div>
</div>
<div class="column is-one-third">
<div class="column is-one-third is-flex">
<div class="media notification">
<div class="media-left">
<a href="{{ book.local_path }}">
@ -49,7 +49,7 @@
</div>
</div>
</div>
<div class="column is-one-third">
<div class="column is-one-third is-flex">
<div class="media notification">
<div class="media-left">
<a href="{{ book.local_path }}">

View file

@ -160,7 +160,7 @@ def get_landing_books():
models.Edition.objects.filter(
review__published_date__isnull=False,
review__deleted=False,
#review__user__local=True,
review__user__local=True,
review__privacy__in=["public", "unlisted"],
)
.exclude(cover__exact="")

View file

@ -30,16 +30,16 @@ def about(request):
books = models.Edition.objects.exclude(cover__exact="")
data["top_rated"] = books.annotate(
rating=Avg("review__rating")
).order_by("rating").first()
rating=Avg("review__rating", filter=Q(review__user__local=True))
).filter(rating__gt=0).order_by("-rating").first()
data["controversial"] = books.annotate(
deviation=StdDev("review__rating")
).order_by("deviation").first()
).filter(deviation__gt=0).order_by("-deviation").first()
data["wanted"] = books.annotate(
shelf_count=Count("shelves", filter=Q(shelves__identifier="to-read"))
).order_by("shelf_count").first()
).order_by("-shelf_count").first()
return TemplateResponse(request, "about/about.html", data)