From a96466bf3549d01d1ce0405f16929062d432386e Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Mon, 27 Dec 2021 13:16:27 -0800 Subject: [PATCH] Adds minor changes to null states for annual summary --- bookwyrm/templates/annual_summary/layout.html | 12 ++++++++++-- bookwyrm/views/annual_summary.py | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/bookwyrm/templates/annual_summary/layout.html b/bookwyrm/templates/annual_summary/layout.html index 99c5343d..20246dd3 100644 --- a/bookwyrm/templates/annual_summary/layout.html +++ b/bookwyrm/templates/annual_summary/layout.html @@ -48,13 +48,19 @@ {% blocktrans %}In {{ year }}, you read {{ books_total }} books
for a total of {{ pages_total }} pages!{% endblocktrans %}

{% trans "That’s great!" %}

- +

{% blocktrans %}That makes an average of {{ pages_average }} pages per book.{% endblocktrans %}

{% if no_page_number %} -

{% blocktrans %}({{ no_page_number }} books don’t have pages){% endblocktrans %}

+

+ {% blocktrans trimmed count counter=no_page_number %} + ({{ no_page_number }} book doesn’t have pages) + {% plural %} + ({{ no_page_number }} books don’t have pages) + {% endblocktrans %} +

{% endif %} @@ -123,6 +129,7 @@
{% include 'snippets/book_cover.html' with book=book_rating_highest.book cover_class='is-w-auto-tablet is-h-l-mobile' %}
+ {% if book_rating_highest %}
{% trans "Your best rated review" %}

@@ -141,6 +148,7 @@ {% endwith %}

+ {% endif %}
diff --git a/bookwyrm/views/annual_summary.py b/bookwyrm/views/annual_summary.py index cfdd6093..06917277 100644 --- a/bookwyrm/views/annual_summary.py +++ b/bookwyrm/views/annual_summary.py @@ -97,7 +97,7 @@ class AnnualSummary(View): "year": year, "books_total": len(read_books_in_year), "books": read_books_in_year, - "pages_total": page_stats["pages__sum"], + "pages_total": page_stats["pages__sum"] or 0, "pages_average": round( page_stats["pages__avg"] if page_stats["pages__avg"] else 0 ),