Add rounding for averages

This commit is contained in:
Joachim 2021-12-21 11:54:20 +01:00
parent c2c57db8e6
commit 4d6c4d3ad2

View file

@ -105,12 +105,12 @@ class AnnualSummary(View):
"books_total": len(read_books_in_year), "books_total": len(read_books_in_year),
"books": read_books_in_year, "books": read_books_in_year,
"pages_total": page_stats["pages__sum"], "pages_total": page_stats["pages__sum"],
"pages_average": page_stats["pages__avg"], "pages_average": round(page_stats["pages__avg"]),
"book_pages_lowest": book_pages_lowest, "book_pages_lowest": book_pages_lowest,
"book_pages_highest": book_pages_highest, "book_pages_highest": book_pages_highest,
"no_page_number": no_page_list, "no_page_number": no_page_list,
"ratings_total": len(ratings), "ratings_total": len(ratings),
"rating_average": ratings_stats["rating__avg"], "rating_average": round(ratings_stats["rating__avg"], 2),
"book_rating_highest": ratings.order_by("-rating").first(), "book_rating_highest": ratings.order_by("-rating").first(),
"best_ratings_books_ids": best_ratings_books_ids, "best_ratings_books_ids": best_ratings_books_ids,
"paginated_years": paginated_years, "paginated_years": paginated_years,