From 624664c4d7c45fd47565c5100dfe56c65d724840 Mon Sep 17 00:00:00 2001 From: Gregory Trullemans Date: Thu, 25 Jan 2024 10:56:59 +0100 Subject: [PATCH] Optimize WellBeing form for smartphone --- .../templates/heightweight/create.html | 20 ++++++------- .../followup/templates/heightweight/list.html | 28 +++++++++++-------- .../followup/templates/wellbeing/create.html | 24 ++++++++-------- jarvis/followup/templates/wellbeing/list.html | 16 ++++++++--- jarvis/people/views.py | 20 +++++++++---- static/css/jarvis.css | 5 ++++ 6 files changed, 69 insertions(+), 44 deletions(-) diff --git a/jarvis/followup/templates/heightweight/create.html b/jarvis/followup/templates/heightweight/create.html index b02bb6e..39bad21 100644 --- a/jarvis/followup/templates/heightweight/create.html +++ b/jarvis/followup/templates/heightweight/create.html @@ -7,7 +7,7 @@
-

{% if heightweight_id %}Edit{% else %}Add{% endif %} height/weight couple

+

{% if heightweight_id %}Edit{% else %}Add{% endif %} height/weight

{% if form.errors %} @@ -21,7 +21,7 @@ {% csrf_token %}
- +
{% if request.user|has_group:"trainer" %} @@ -36,34 +36,34 @@
- -
+
{{ form.date }} {% if form.date.errors %}{% for error in form.date.errors %}{{ error }}{% endfor %}{% endif %}
- -
+
{{ form.height }} {% if form.height.errors %} {% for error in form.height.errors %}{{ error }}{% endfor %}{% endif %}
- +
+ class="col-4 col-sm-3 col-md-3 col-lg-3 {% if form.hips_height.errors %}has-danger{% endif %}"> {{ form.hips_height }} {% if form.hips_height.errors %} {% for error in form.hips_height.errors %}{{ error }}{% endfor %}{% endif %}
- -
+
{{ form.weight }} {% if form.weight.errors %} {% for error in form.weight.errors %}{{ error }}{% endfor %}{% endif %}
diff --git a/jarvis/followup/templates/heightweight/list.html b/jarvis/followup/templates/heightweight/list.html index f28184b..d136f80 100644 --- a/jarvis/followup/templates/heightweight/list.html +++ b/jarvis/followup/templates/heightweight/list.html @@ -6,10 +6,10 @@
-
+

Height/Weight list {% if gymnast %}for {{ gymnast }}{% endif %}

-
+
{% if request.user|has_group:"trainer" %} @@ -21,18 +21,20 @@
-
+
{% if heightweight_list %} + {% if not gymnast %} - - - - + {% endif %} + + + + @@ -43,12 +45,14 @@ - + + {% if not gymnast %} - - - - + + + + {% if not gymnast %} + {% endif %} @@ -44,10 +46,16 @@ - + + {% if not gymnast %} + {{ wellbeing.gymnast }} + + + {% endif %}
DateGymnastHeightHips heightWeightBMIHeightHips heightWeightBMI
{{ heightweight.date | date:"d-m-Y" }}{{ heightweight.date | date:"j-n-Y" }}{{ heightweight.gymnast }}{{ heightweight.height }}{% if heightweight.hips_height == None %}-{% else %}{{ heightweight.hips_height }}{% endif %}{{ heightweight.weight }} + {% endif %} + {{ heightweight.height }}{% if heightweight.hips_height == None %}-{% else %}{{ heightweight.hips_height }}{% endif %}{{ heightweight.weight }} {% if gymnast %} {% if gymnast.gender == 0 %} {% if heightweight.bmi < 19 %} diff --git a/jarvis/followup/templates/wellbeing/create.html b/jarvis/followup/templates/wellbeing/create.html index 99a914a..7949969 100644 --- a/jarvis/followup/templates/wellbeing/create.html +++ b/jarvis/followup/templates/wellbeing/create.html @@ -14,7 +14,7 @@ {% csrf_token %}
-
+
{% if request.user|has_group:"trainer" %} {{ form.gymnast }} {{ form.gymnast_related }} @@ -31,7 +31,7 @@
-
+
{{ form.date }} {% if form.date.errors %}{% for error in form.date.errors %}{{ error }}{% endfor %}{% endif %}
@@ -54,8 +54,8 @@ {{ form.mindstate }} {% if form.mindstate.errors %} {% for error in form.mindstate.errors %}{{ error }}{% endfor %}{% endif %}
-
-

(1: Very Bad - 10: Very Good)

+
+

(1: Very Bad - 10: Very Good)

@@ -64,8 +64,8 @@ {{ form.sleep }} {% if form.sleep.errors %} {% for error in form.sleep.errors %}{{ error }}{% endfor %}{% endif %}
-
-

(1: Very Bad - 10: Very Good)

+
+

(1: Very Bad - 10: Very Good)

@@ -74,8 +74,8 @@ {{ form.stress }} {% if form.stress.errors %} {% for error in form.stress.errors %}{{ error }}{% endfor %}{% endif %}
-
-

(1: Very Low - 10: Very High)

+
+

(1: Very Low - 10: Very High)

@@ -84,8 +84,8 @@ {{ form.fatigue }} {% if form.fatigue.errors %} {% for error in form.fatigue.errors %}{{ error }}{% endfor %}{% endif %}
-
-

(1: Very Low - 10: Very High)

+
+

(1: Very Low - 10: Very High)

@@ -94,8 +94,8 @@ {{ form.muscle_soreness }} {% if form.muscle_soreness.errors %} {% for error in form.muscle_soreness.errors %}{{ error }}{% endfor %}{% endif %}
-
-

(1: Very Low - 10: Very High)

+
+

(1: Very Low - 10: Very High)

diff --git a/jarvis/followup/templates/wellbeing/list.html b/jarvis/followup/templates/wellbeing/list.html index 6e2cd04..b4b2025 100644 --- a/jarvis/followup/templates/wellbeing/list.html +++ b/jarvis/followup/templates/wellbeing/list.html @@ -6,10 +6,10 @@
-
+

Well being list {% if gymnast %}for {{ gymnast }}{% endif %}

-
+
{% if request.user|has_group:"trainer" %} @@ -28,7 +28,9 @@
DateGymnastMindstate Sleep Stress {{ wellbeing.date | date:"d-m-Y" }} + {{ wellbeing.date | date:"j-n-Y" }} + - {{ wellbeing.gymnast }} {% if wellbeing.mindstate < 5%}{% endif %} {{ wellbeing.mindstate }} diff --git a/jarvis/people/views.py b/jarvis/people/views.py index 7d7d3f6..052c2f9 100644 --- a/jarvis/people/views.py +++ b/jarvis/people/views.py @@ -260,11 +260,16 @@ def gymnast_display_physiological(request, gymnast_id): Args: gymnast_id (int) identifiant du gymnast """ - injuries_list = Injury.objects.filter(gymnast=gymnast_id).order_by("date") - wellbeing_list = WellBeing.objects.filter(gymnast=gymnast_id).order_by("date") - height_weight_list = HeightWeight.objects.filter(gymnast=gymnast_id).order_by( - "date" - ) + start_date = pendulum.now().date().subtract(months=6) + injuries_list = Injury.objects.filter( + gymnast=gymnast_id, date__gte=start_date + ).order_by("date") + wellbeing_list = WellBeing.objects.filter( + gymnast=gymnast_id, date__gte=start_date + ).order_by("date") + height_weight_list = HeightWeight.objects.filter( + gymnast=gymnast_id, date__gte=start_date + ).order_by("date") context = { "injuries_list": injuries_list, @@ -286,8 +291,11 @@ def gymnast_display_scores_chrono(request, gymnast_id): Args: gymnast_id (int) identifiant du gymnast """ + start_date = pendulum.now().date().subtract(months=6) score_list = Point.objects.filter(gymnast=gymnast_id).order_by("-event__date_begin") - chrono_list = Chrono.objects.filter(gymnast=gymnast_id).order_by("date") + chrono_list = Chrono.objects.filter( + gymnast=gymnast_id, date__gte=start_date + ).order_by("date") base_queryset = chrono_list.values("date").annotate(score_avg=Avg("tof")) context = { diff --git a/static/css/jarvis.css b/static/css/jarvis.css index 33e7f43..4166e51 100644 --- a/static/css/jarvis.css +++ b/static/css/jarvis.css @@ -90,6 +90,11 @@ textarea.form-control { color: #0CA3E0 !important; } +.text-form-info { + font-weight: lighter !important; + font-size: 12px; +} + .progress-bar-primary { background: #ba54f5; background-image: -webkit-linear-gradient(to bottom left, #ba54f5, #e14eca, #ba54f5);