From b53f83a76c9fd0e13f073083eb7232c0535c1d6d Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Wed, 29 Apr 2020 17:18:12 +0200 Subject: [PATCH] improved stats page --- cookbook/templates/stats.html | 11 ++++++++++- cookbook/views/data.py | 6 ++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/cookbook/templates/stats.html b/cookbook/templates/stats.html index a2753d500..eb97fac40 100644 --- a/cookbook/templates/stats.html +++ b/cookbook/templates/stats.html @@ -21,6 +21,10 @@ class="badge badge-pill badge-info">{{ counts.recipes }}
  • {% trans 'Keywords' %} : {{ counts.keywords }}
  • +
  • {% trans 'Units' %} : {{ counts.units }}
  • +
  • {% trans 'Ingredients' %} : {{ counts.ingredients }}
  • {% trans 'Recipe Imports' %} : {{ counts.recipe_import }}
  • @@ -34,7 +38,12 @@ diff --git a/cookbook/views/data.py b/cookbook/views/data.py index e0bde3449..eb30c8839 100644 --- a/cookbook/views/data.py +++ b/cookbook/views/data.py @@ -93,6 +93,12 @@ def statistics(request): counts.recipes = Recipe.objects.count() counts.keywords = Keyword.objects.count() counts.recipe_import = RecipeImport.objects.count() + counts.units = Unit.objects.count() + counts.ingredients = Ingredient.objects.count() + counts.comments = Comment.objects.count() + + counts.recipes_internal = Recipe.objects.filter(internal=True).count() + counts.recipes_external = counts.recipes - counts.recipes_internal counts.recipes_no_keyword = Recipe.objects.filter(keywords=None).count()