diff --git a/jarvis/followup/admin.py b/jarvis/followup/admin.py index ff48c1c..5487722 100644 --- a/jarvis/followup/admin.py +++ b/jarvis/followup/admin.py @@ -14,6 +14,7 @@ from .models import ( Injury, WellBeing, Intensity, + InjuryType, HeightWeight, LearnedSkill, ChronoDetails, @@ -100,6 +101,14 @@ class InjuryLocationAdmin(admin.ModelAdmin): search_fields = ("label",) +class InjuryTypeAdmin(admin.ModelAdmin): + model = InjuryType + + list_display = ("label",) + fields = ("label",) + search_fields = ("label",) + + class InjuryAdmin(admin.ModelAdmin): model = Injury @@ -307,6 +316,7 @@ admin.site.register(Chrono, ChronoAdmin) admin.site.register(Injury, InjuryAdmin) admin.site.register(WellBeing, WellBeingAdmin) admin.site.register(Intensity, IntensityAdmin) +admin.site.register(InjuryType, InjuryTypeAdmin) admin.site.register(LearnedSkill, LearnedSkillAdmin) admin.site.register(HeightWeight, HeightWeightAdmin) admin.site.register(ChronoDetails, ChronoDetailsAdmin) diff --git a/jarvis/followup/forms.py b/jarvis/followup/forms.py index 6c2ae8b..a4c8393 100644 --- a/jarvis/followup/forms.py +++ b/jarvis/followup/forms.py @@ -188,6 +188,7 @@ class InjuryForm(forms.ModelForm): "gymnast", "date", "mechanism", + "injury_type", "location", "body_side", "nb_week_off", @@ -204,6 +205,7 @@ class InjuryForm(forms.ModelForm): ), "gymnast": forms.HiddenInput(), "skill": forms.HiddenInput(), + "injury_type": forms.Select(attrs={"class": "form-control selectpicker"}), "mechanism": forms.Select(attrs={"class": "form-control selectpicker"}), "location": forms.Select(attrs={"class": "form-control selectpicker"}), "body_side": forms.Select(attrs={"class": "form-control selectpicker"}), @@ -313,7 +315,7 @@ class WellBeingForm(forms.ModelForm): "informations": forms.Textarea( attrs={ "class": "form-control", - "placeholder": "Informations about your well being : context (why, where, …), possible consequencies, …", # pylint: disable=line-too-long + "placeholder": "Informations about the weel being state : context (why, where, when, …), possible consequencies, …", # pylint: disable=line-too-long } ), } diff --git a/jarvis/followup/models.py b/jarvis/followup/models.py index a40178e..ff27f4c 100644 --- a/jarvis/followup/models.py +++ b/jarvis/followup/models.py @@ -161,6 +161,21 @@ class InjuryLocation(models.Model): return f"{self.label}" +class InjuryType(models.Model): + """ + Classe représentant les types de blessures + """ + + class Meta: + verbose_name = "Injury Type" + verbose_name_plural = "Injury Types" + + label = models.CharField(max_length=100, null=False, blank=False) + + def __str__(self): + return f"{self.label}" + + class Injury(Markdownizable, Seasonisable): """ La classe `Injury` permet d'indiquer qu'un gymnaste a eu un blessure, en liaison avec un @@ -193,6 +208,15 @@ class Injury(Markdownizable, Seasonisable): related_name="injuries", on_delete=models.CASCADE, ) + injury_type = models.ForeignKey( + InjuryType, + verbose_name="Injury Type", + related_name="injuries", + on_delete=models.SET_NULL, + default=None, + blank=True, + null=True, + ) body_side = models.PositiveSmallIntegerField( choices=INJURY_BODY_SIDE_CHOICE, verbose_name="Body side" ) @@ -369,6 +393,18 @@ class WellBeing(Markdownizable, Seasonisable): def __str__(self): return f"{self.gymnast} - {self.date} : {self.mindstate} | {self.sleep} | {self.stress} | {self.fatigue} | {self.muscle_soreness}" + @property + def get_inversed_stress(self): + return 10 - self.stress + + @property + def get_inversed_fatigue(self): + return 10 - self.fatigue + + @property + def get_inversed_muscle_soreness(self): + return 10 - self.muscle_soreness + class GymnastHasRoutine(models.Model): """ diff --git a/jarvis/followup/templates/injuries/create.html b/jarvis/followup/templates/injuries/create.html index c22c50e..a6750e3 100644 --- a/jarvis/followup/templates/injuries/create.html +++ b/jarvis/followup/templates/injuries/create.html @@ -47,6 +47,13 @@ {% if form.mechanism.errors %} {% for error in form.mechanism.errors %}{{ error }}{% endfor %}{% endif %} +
No additionnal details.
{% endif %} - + +Mindstate : {{ wellbeing.mindstate }} | Sleep : {{ wellbeing.sleep }} | Stress : {{ wellbeing.stress }} | Fatigue : {{ wellbeing.fatigue }} | Muscle soreness : {{ wellbeing.muscle_soreness }}
+Excellente journée
Jarvis
""", ) diff --git a/jarvis/people/templates/gymnasts/tabs/tab_physiological.html b/jarvis/people/templates/gymnasts/tabs/tab_physiological.html index 4f05737..234382f 100644 --- a/jarvis/people/templates/gymnasts/tabs/tab_physiological.html +++ b/jarvis/people/templates/gymnasts/tabs/tab_physiological.html @@ -74,6 +74,7 @@No chrono recorded for this gymnast.
+No chrono recorded yet for this gymnast.
{% endif %}