From 333ba356bdd71c3628910014b81ad385cff40473 Mon Sep 17 00:00:00 2001 From: Gregory Trullemans Date: Thu, 22 Jun 2023 13:14:56 +0200 Subject: [PATCH] Minor modification in interface --- .../core/templates/dashboard/dashboard.html | 19 ++++----- jarvis/core/views.py | 35 +++++++++------- jarvis/followup/views.py | 40 +++++++++---------- .../gymnasts/tabs/tab_documents.html | 2 +- .../gymnasts/tabs/tab_scores_and_chronos.html | 12 +++--- 5 files changed, 57 insertions(+), 51 deletions(-) diff --git a/jarvis/core/templates/dashboard/dashboard.html b/jarvis/core/templates/dashboard/dashboard.html index 1790604..4d78f36 100644 --- a/jarvis/core/templates/dashboard/dashboard.html +++ b/jarvis/core/templates/dashboard/dashboard.html @@ -26,7 +26,7 @@

Hi {{ user.username }} !

-
+

Welcome to Jarvi v0.84 (last update : 19-06-2023)

This application is here to help coaches to manage the gymnasts (evolution, evaluation, routines, scores, …). This tool is not perfect so feel free to make improvement proposals, bug reports, … by sending me an email.

You can find the user manual here (in french).

@@ -38,7 +38,8 @@

Statistics

-
+
+ Week {{ week_number }}
@@ -64,8 +65,8 @@
{% else %} -
- No statistics to display. +
+ No statistics to display. {% endif %}
@@ -80,7 +81,7 @@

Next Events

-
+
{% if event_list %} {% for event in event_list %} @@ -98,7 +99,7 @@ {% endfor %}
{% else %} - No future event defined + No future event defined. {% endif %}
@@ -109,7 +110,7 @@

Updated needed

-
+
{% if waiting_update_gymnast %} {% for gymnast in waiting_update_gymnast %} @@ -131,7 +132,7 @@

Last updated gymnasts

-
+
{% if last_updated_gymnast %}
{% for gymnast in last_updated_gymnast %} @@ -142,7 +143,7 @@ {% endfor %}
{% else %} - No update since your last visit + No update since your last visit. {% endif %}
diff --git a/jarvis/core/views.py b/jarvis/core/views.py index 98db8be..f414f7d 100644 --- a/jarvis/core/views.py +++ b/jarvis/core/views.py @@ -91,14 +91,18 @@ def home(request): """ Génère la page d'accueil du site basée sur la saison (si celle-ci est connue) """ + # print("In home function") + today = pendulum.now().date() + _, week_number = from_date_to_week_number(today) + week_number = 42 event_list = Event.objects.filter(date_begin__gte=timezone.now()).order_by( "date_begin" )[:10] quote = Citation.objects.order_by("?").first() - # print(quote) - # mettre tout ca en cache. + # A METTRE EN CACHE. + # last_updated_gymnast = None last_updated_gymnast = Gymnast.objects.filter( Q(mindstate__created_at__gt=request.user.last_login) | Q(points__created_at__gt=request.user.last_login) @@ -127,27 +131,26 @@ def home(request): # (get_number_of_weeks_between(datetime(2021, 9, 1), datetime.now()) / 52) * 100 # ) - date_begin = pendulum.now().date() - season, week_number = from_date_to_week_number(date_begin) percentage_week = (week_number / 52) * 100 birthday_list = next_birthdays(request, 10) - # check if gymnast have point - # --------------------------- - # 1. récupérer tous les évènements passés - # 2. pour chaque event, vérifier que tous les gymnastes renseignés - # dans les participants ont des points associés. - # S'il n'y a pas de point, faire une alerte à l'utilisateur qui se connecte. + # # check if gymnast have point + # # --------------------------- + # # 1. récupérer tous les évènements passés + # # 2. pour chaque event, vérifier que tous les gymnastes renseignés + # # dans les participants ont des points associés. + # # S'il n'y a pas de point, faire une alerte à l'utilisateur qui se connecte. - # Check if gymnast have update - # ----------------------------- - # lister tous les gymnastes qui n'ont pas eu d'update depuis... 2 semaines ? - # peut-être le paramètre (en jour) devrait être stocké en DB. - # S'il n'y a pas d'update, faire une alerte à l'utilisateur qui se connecte. + # # Check if gymnast have update + # # ----------------------------- + # # lister tous les gymnastes qui n'ont pas eu d'update depuis... 2 semaines ? + # # peut-être le paramètre (en jour) devrait être stocké en DB. + # # S'il n'y a pas d'update, faire une alerte à l'utilisateur qui se connecte. context = { "quote": quote, + "week_number": week_number, "event_list": event_list, "last_updated_gymnast": last_updated_gymnast, "waiting_update_gymnast": waiting_update_gymnast, @@ -160,7 +163,9 @@ def home(request): "percentage_week": percentage_week, "birthday_list": birthday_list, } + # print("out home function") return render(request, "dashboard/dashboard.html", context) + # return render(request, "dashboard/dashboard.html", {}) @login_required diff --git a/jarvis/followup/views.py b/jarvis/followup/views.py index 68e2350..87c5da7 100644 --- a/jarvis/followup/views.py +++ b/jarvis/followup/views.py @@ -493,26 +493,26 @@ def note_create_or_update(request, note_id=None, gymnast_id=None): if form.is_valid(): new_note = form.save() - # if ( - # (new_note.gymnast.user.email or new_note.gymnast.email_trainer) - # and ((not note_id) or (note_id and note.status == 0)) - # and new_note.status == 1 - # ): - # send_mail( - # "Nouvelle note", - # "Une nouvelle note vous a été envoyée", - # settings.EMAIL_HOST_USER, - # [new_note.gymnast.user.email, new_note.gymnast.email_trainer], - # fail_silently=False, - # html_message="""

Bonjour,

- #

Une nouvelle note vous a été envoyée. Vous pouvez la consulter en liquant ici.


Excellente journée

Jarvis

""", - # ) + if ( + (new_note.gymnast.user.email or new_note.gymnast.email_trainer) + and ((not note_id) or (note_id and note.status == 0)) + and new_note.status == 1 + ): + send_mail( + "Nouvelle note", + "Une nouvelle note vous a été envoyée", + settings.EMAIL_HOST_USER, + [new_note.gymnast.user.email, new_note.gymnast.email_trainer], + fail_silently=False, + html_message="""

Bonjour,

+

Une nouvelle note vous a été envoyée. Vous pouvez la consulter en cliquant ici.


Excellente journée

Jarvis

""", + ) return HttpResponseRedirect( reverse("gymnast_details_tab", args=(new_note.gymnast.id, "event")) ) diff --git a/jarvis/people/templates/gymnasts/tabs/tab_documents.html b/jarvis/people/templates/gymnasts/tabs/tab_documents.html index 31956e9..d2f8df6 100644 --- a/jarvis/people/templates/gymnasts/tabs/tab_documents.html +++ b/jarvis/people/templates/gymnasts/tabs/tab_documents.html @@ -11,7 +11,7 @@

Report


Career
-

(Under construction)

+

(Under construction)


Evaluation

Report

diff --git a/jarvis/people/templates/gymnasts/tabs/tab_scores_and_chronos.html b/jarvis/people/templates/gymnasts/tabs/tab_scores_and_chronos.html index 252a47b..a6f3f42 100644 --- a/jarvis/people/templates/gymnasts/tabs/tab_scores_and_chronos.html +++ b/jarvis/people/templates/gymnasts/tabs/tab_scores_and_chronos.html @@ -132,7 +132,7 @@ datasets: [ {% if score_routine1_list %} { - label: 'R1', + label: 'Q1R1', cubicInterpolationMode: 'monotone', backgroundColor: gradient_stroke_1, borderColor: 'rgb(255, 99, 132)', @@ -144,7 +144,7 @@ {% if score_routine2_list %} { - label: 'R2', + label: 'Q1R2', cubicInterpolationMode: 'monotone', backgroundColor: gradient_stroke_2, borderColor: 'rgb(255, 159, 64)', @@ -156,7 +156,7 @@ {% if score_routine3_list %} { - label: 'R3', + label: 'Q2R1', cubicInterpolationMode: 'monotone', backgroundColor: gradient_stroke_3, borderColor: 'rgb(54, 162, 235)', @@ -288,7 +288,7 @@ {% endif %} {% if chrono_r1 %} { - label: 'R1', + label: 'Q1R1', cubicInterpolationMode: 'monotone', backgroundColor: gradient_stroke_2, borderColor: 'rgb(255, 99, 132)', @@ -299,7 +299,7 @@ {% endif %} {% if chrono_r2 %} { - label: 'R2', + label: 'Q1R2', cubicInterpolationMode: 'monotone', backgroundColor: gradient_stroke_3, borderColor: 'rgb(255, 159, 64)', @@ -310,7 +310,7 @@ {% endif %} {% if chrono_rf %} { - label: 'R3', + label: 'Q2R1', cubicInterpolationMode: 'monotone', backgroundColor: gradient_stroke_4, borderColor: 'rgb(255, 205, 86)',