From 3a94fe636f2516dd3ebfe7a6f07d6de35ddba906 Mon Sep 17 00:00:00 2001 From: Gregory Trullemans Date: Tue, 17 Oct 2023 10:26:19 +0200 Subject: [PATCH] Update height/weight email and Wellbeing JS --- .../followup/templates/wellbeing/create.html | 69 ++++++++++++++++--- jarvis/followup/views.py | 7 +- 2 files changed, 65 insertions(+), 11 deletions(-) diff --git a/jarvis/followup/templates/wellbeing/create.html b/jarvis/followup/templates/wellbeing/create.html index f155115..f833d77 100644 --- a/jarvis/followup/templates/wellbeing/create.html +++ b/jarvis/followup/templates/wellbeing/create.html @@ -98,12 +98,16 @@

(1: Very Low - 10: Very High)

+
+ +
- +
{{ form.informations }}
+
@@ -116,15 +120,64 @@ {% block footerscript %} - {% if request.session.template == 0 %} diff --git a/jarvis/followup/views.py b/jarvis/followup/views.py index 68ffbcb..04efaf5 100644 --- a/jarvis/followup/views.py +++ b/jarvis/followup/views.py @@ -1059,9 +1059,10 @@ def heightweight_create_or_update(request, heightweight_id=None, gymnast_id=None # notification receiver = [] - height = form.cleaned_data["height"] + height = form.cleaned_data["height"] / 100 weight = form.cleaned_data["weight"] bmi = weight / (height * height) + bmi = format(bmi, ".1f") gymnast = Gymnast.objects.get(pk=form.cleaned_data["gymnast"].id) functionality = ContentType.objects.get(model="heightweight") for notification in gymnast.notifications.filter( @@ -1071,12 +1072,12 @@ def heightweight_create_or_update(request, heightweight_id=None, gymnast_id=None send_mail( f"{gymnast} : Nouveau poids/taille enregistré", - f"Un nouveau poids/taille enregistré pour {gymnast} : {height} / {weight} ({bmi}).", + f"Un nouveau poids/taille enregistré pour {gymnast} : {height}cm / {weight}kg ({bmi}).", settings.EMAIL_HOST_USER, receiver, fail_silently=False, html_message=f"""

Bonjour,

-

Un nouveau poids/taille enregistré pour {gymnast} : {height} / {weight} ({bmi}).


+

Un nouveau poids/taille enregistré pour {gymnast} : {height}cm / {weight}kg ({bmi}).


Excellente journée

Jarvis

""", )