Merge pull request #1701 from bookwyrm-social/annual-summary-tweaks

Adds minor changes to null states for annual summary
This commit is contained in:
Mouse Reeve 2021-12-27 13:31:57 -08:00 committed by GitHub
commit ed3ae0940b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View file

@ -48,13 +48,19 @@
{% blocktrans %}In {{ year }}, you read {{ books_total }} books<br />for a total of {{ pages_total }} pages!{% endblocktrans %}
</h2>
<p class="subtitle is-5">{% trans "Thats great!" %}</p>
<p class="title is-4 is-serif">
{% blocktrans %}That makes an average of {{ pages_average }} pages per book.{% endblocktrans %}
</p>
{% if no_page_number %}
<p class="subtitle is-6">{% blocktrans %}({{ no_page_number }} books dont have pages){% endblocktrans %}</p>
<p class="subtitle is-6">
{% blocktrans trimmed count counter=no_page_number %}
({{ no_page_number }} book doesnt have pages)
{% plural %}
({{ no_page_number }} books dont have pages)
{% endblocktrans %}
</p>
{% endif %}
</div>
</div>
@ -123,6 +129,7 @@
<div class="column is-3 is-offset-3">
<a href="{{ book_rating_highest.book.local_path }}">{% include 'snippets/book_cover.html' with book=book_rating_highest.book cover_class='is-w-auto-tablet is-h-l-mobile' %}</a>
</div>
{% if book_rating_highest %}
<div class="column is-4">
{% trans "Your best rated review" %}
<p class="title is-4 is-serif is-italic">
@ -141,6 +148,7 @@
{% endwith %}
</p>
</div>
{% endif %}
</div>
<div class="columns">

View file

@ -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
),