From f2592d62f8026acd8a2135db58c68eb56f346dda Mon Sep 17 00:00:00 2001 From: Gregory Trullemans Date: Mon, 20 Dec 2021 10:08:04 +0100 Subject: [PATCH] Update Dashboard --- config/views.py | 6 ++++-- templates/ultron/dashboard/dashboard.html | 25 +++++++++++++++-------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/config/views.py b/config/views.py index e2f0b6058e..6f4a1cbd89 100644 --- a/config/views.py +++ b/config/views.py @@ -93,11 +93,12 @@ def home(request): | Q(known_skills__created_at__gt=request.user.last_login) ).distinct() - nb_gymnast = Gymnast.objects.filter(is_active=True).count() + nb_active_gymnast = Gymnast.objects.filter(is_active=True).count() nb_event = Event.objects.all().count() nb_skill = Skill.objects.all().count() nb_routine = Routine.objects.all().count() nb_score = Point.objects.all().count() + nb_club = Club.objects.all().count() percentage_week = int( (get_number_of_weeks_between(datetime(2021, 9, 1), datetime.now()) / 52) * 100 ) @@ -119,11 +120,12 @@ def home(request): context = { "event_list": event_list, "last_updated_gymnast": last_updated_gymnast, - "nb_gymnast": nb_gymnast, + "nb_active_gymnast": nb_active_gymnast, "nb_event": nb_event, "nb_skill": nb_skill, "nb_routine": nb_routine, "nb_score": nb_score, + "nb_club": nb_club, "percentage_week": percentage_week, "birthday_list": birthday_list, } diff --git a/templates/ultron/dashboard/dashboard.html b/templates/ultron/dashboard/dashboard.html index 10f88bec5f..898843f97e 100644 --- a/templates/ultron/dashboard/dashboard.html +++ b/templates/ultron/dashboard/dashboard.html @@ -28,14 +28,23 @@
- {% if nb_gymnast or nb_event or nb_skill or nb_routine or nb_score %} - + {% if nb_active_gymnast or nb_event or nb_skill or nb_routine or nb_score or nb_club %} +
+
+
    + {% if nb_active_gymnast %}
  • {{nb_active_gymnast }} active gymnasts
  • {% endif %} + {% if nb_event %}
  • {{ nb_event }} events
  • {% endif %} + {% if nb_score %}
  • {{ nb_score }} scores
  • {% endif %} +
+
+
+
    + {% if nb_skill %}
  • {{ nb_skill }} skills
  • {% endif %} + {% if nb_routine %}
  • {{ nb_routine }} routines
  • {% endif %} + {% if nb_club %}
  • {{ nb_club }} clubs
  • {% endif %} +
+
+
{% else %}
No statistics to display.