diff --git a/jarvis/followup/admin.py b/jarvis/followup/admin.py index ad4f16a..ff48c1c 100644 --- a/jarvis/followup/admin.py +++ b/jarvis/followup/admin.py @@ -112,14 +112,21 @@ class InjuryAdmin(admin.ModelAdmin): "mechanism", "nb_week_off", "informations", - ) # educative + ) readonly_fields = ("season", "week_number", "created_at", "updated_at") - list_display = ("date", "gymnast", "skill") # educative + list_display = ( + "date", + "gymnast", + "mechanism", + "location", + "body_side", + "nb_week_off", + ) list_filter = ( ("gymnast", RelatedDropdownFilter), + ("mechanism", DropdownFilter), ("location", RelatedDropdownFilter), ("body_side", DropdownFilter), - ("mechanism", DropdownFilter), ) date_hierarchy = "date" search_fields = ("date", "gymnast") # educative diff --git a/jarvis/followup/forms.py b/jarvis/followup/forms.py index 0e8b4ff..6c2ae8b 100644 --- a/jarvis/followup/forms.py +++ b/jarvis/followup/forms.py @@ -191,6 +191,7 @@ class InjuryForm(forms.ModelForm): "location", "body_side", "nb_week_off", + "diagnosis", "informations", ) widgets = { @@ -209,10 +210,16 @@ class InjuryForm(forms.ModelForm): "nb_week_off": forms.NumberInput( attrs={"class": "form-control", "placeholder": "xx"} ), + "diagnosis": forms.Textarea( + attrs={ + "class": "form-control", + "placeholder": "Informations about diagnosis", # pylint: disable=line-too-long + } + ), "informations": forms.Textarea( attrs={ "class": "form-control", - "placeholder": "Informations about injury: context (why, where, …), consequencies, re-education exercices, …", # pylint: disable=line-too-long + "placeholder": "Informations about injury: consequencies, re-education exercices, …", # pylint: disable=line-too-long } ), } diff --git a/jarvis/followup/migrations/0052_injury_location.py b/jarvis/followup/migrations/0052_injury_location.py index c54285b..d901d06 100644 --- a/jarvis/followup/migrations/0052_injury_location.py +++ b/jarvis/followup/migrations/0052_injury_location.py @@ -15,7 +15,6 @@ class Migration(migrations.Migration): model_name="injury", name="location", field=models.ForeignKey( - # default=1, on_delete=django.db.models.deletion.CASCADE, related_name="injuries", to="followup.injurylocation", @@ -24,6 +23,5 @@ class Migration(migrations.Migration): null=True, blank=True, ), - # preserve_default=False, ), ] diff --git a/jarvis/followup/migrations/0056_alter_injury_location.py b/jarvis/followup/migrations/0056_alter_injury_location.py new file mode 100644 index 0000000..e16777a --- /dev/null +++ b/jarvis/followup/migrations/0056_alter_injury_location.py @@ -0,0 +1,24 @@ +# Generated by Django 4.2 on 2023-07-08 17:53 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ("followup", "0055_alter_injury_body_side"), + ] + + operations = [ + migrations.AlterField( + model_name="injury", + name="location", + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="injuries", + to="followup.injurylocation", + verbose_name="Location", + ), + ), + ] diff --git a/jarvis/followup/migrations/0057_injury_diagnosis.py b/jarvis/followup/migrations/0057_injury_diagnosis.py new file mode 100644 index 0000000..1746ac9 --- /dev/null +++ b/jarvis/followup/migrations/0057_injury_diagnosis.py @@ -0,0 +1,23 @@ +# Generated by Django 4.2 on 2023-07-08 18:06 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("followup", "0056_alter_injury_location"), + ] + + operations = [ + migrations.AddField( + model_name="injury", + name="diagnosis", + field=models.TextField( + blank=True, + help_text="Only normal text is authorized", + null=True, + verbose_name="Diagnosis", + ), + ), + ] diff --git a/jarvis/followup/models.py b/jarvis/followup/models.py index a5e67ff..a40178e 100644 --- a/jarvis/followup/models.py +++ b/jarvis/followup/models.py @@ -199,6 +199,12 @@ class Injury(Markdownizable, Seasonisable): mechanism = models.PositiveSmallIntegerField( choices=INJURY_MECHANISM_CHOICE, verbose_name="Injury mechanism" ) + diagnosis = models.TextField( + null=True, + blank=True, + verbose_name="Diagnosis", + help_text="Only normal text is authorized", + ) nb_week_off = models.SmallIntegerField( blank=True, null=True, verbose_name="# week off" ) @@ -206,10 +212,10 @@ class Injury(Markdownizable, Seasonisable): updated_at = models.DateTimeField(auto_now=True) def __str__(self): - return f"{self.gymnast} ({self.date})" + return f"{self.gymnast} ({self.date}): {self.mechanism} on {self.location} {self.body_side}" def timeline_representation(self): - return f"
  • {self.date:%d %b %Y} - Accident ({self.skill}): {self.nb_week_off} (weeks off)
  • " + return f"
  • {self.date:%d %b %Y} - Injury ({self.skill}): {self.nb_week_off} (weeks off)
  • " class LearnedSkill(Seasonisable): diff --git a/jarvis/followup/templates/heightweight/create.html b/jarvis/followup/templates/heightweight/create.html index b02bb6e..bc33c87 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 %} diff --git a/jarvis/followup/templates/heightweight/list.html b/jarvis/followup/templates/heightweight/list.html index ac0dadd..51cd6ca 100644 --- a/jarvis/followup/templates/heightweight/list.html +++ b/jarvis/followup/templates/heightweight/list.html @@ -7,7 +7,7 @@
    -

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

    +

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

    diff --git a/jarvis/followup/templates/injuries/list.html b/jarvis/followup/templates/injuries/list.html index 9af4dc4..5cfc872 100644 --- a/jarvis/followup/templates/injuries/list.html +++ b/jarvis/followup/templates/injuries/list.html @@ -30,7 +30,7 @@ Mechanism Location Side - Skill + Skill # Week off @@ -49,7 +49,7 @@ {{ injury.get_body_side_display }} {% if injury.skill %} - {{ injury.skill }} + {{ injury.skill.notation }} {% else %} - {% endif %} diff --git a/jarvis/followup/templates/wellbeing/create.html b/jarvis/followup/templates/wellbeing/create.html index f155115..af0f69c 100644 --- a/jarvis/followup/templates/wellbeing/create.html +++ b/jarvis/followup/templates/wellbeing/create.html @@ -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)

    @@ -65,7 +65,7 @@ {% 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)

    @@ -75,7 +75,7 @@ {% 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)

    @@ -85,7 +85,7 @@ {% 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)

    @@ -95,7 +95,7 @@ {% 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/views.py b/jarvis/followup/views.py index 3792793..c875c0c 100644 --- a/jarvis/followup/views.py +++ b/jarvis/followup/views.py @@ -1470,9 +1470,7 @@ def season_information_create_or_update( ) ) else: - return render( - request, "followup/seasoninformations/create.html", {"form": form} - ) + return render(request, "seasoninformations/create.html", {"form": form}) form = SeasonInformationForm(instance=season_information, initial=data) context = {"form": form, "season_information_id": season_information_id} diff --git a/jarvis/people/templates/gymnasts/details.html b/jarvis/people/templates/gymnasts/details.html index 8919136..8bb0663 100644 --- a/jarvis/people/templates/gymnasts/details.html +++ b/jarvis/people/templates/gymnasts/details.html @@ -25,7 +25,7 @@

    {{ last_season_information.club.name }}
    - {{ last_season_information.get_category_display }} + {{ gymnast.birthdate.year }} - {{ last_season_information.get_category_display }}

    @@ -35,7 +35,8 @@ {% if height_weight %} {{ height_weight.0.height }}cm - {{ height_weight.0.weight }}kg ({{ height_weight.0.date | date:"d-m-Y" }})
    {% endif %} - {{ last_season_information.number_of_training_sessions_per_week }} training/week for {{ last_season_information.number_of_hours_per_week }} hours/week
    + Training: {{ last_season_information.number_of_training_sessions_per_week }}/week ({{ last_season_information.number_of_hours_per_week }} hours)
    + S&C: {{ last_season_information.number_of_s_and_c_sessions_per_week }}/week({{ last_season_information.number_of_s_and_c_hours_per_week }} hours)

    {% if user_is_trainer and gymnast.informations %}

    {{ gymnast.to_markdown | safe }}

    @@ -45,7 +46,7 @@ 10 | : {% if best_straightjump %}{{ best_straightjump.0.tof }} ({{ best_straightjump.0.date | date:"d-m-Y" }}){% else %} (no information){% endif %}
  • - Routine : {% if best_routine %}{{ best_routine.0.tof }} ({{ best_routine.0.date | date:"d-m-Y" }}){% else %} (no information){% endif %} + Q1R1 : {% if best_routine %}{{ best_routine.0.tof }} ({{ best_routine.0.date | date:"d-m-Y" }}){% else %} (no information){% endif %}
  • {% if user_is_trainer %} Add season details - diff --git a/jarvis/people/templates/gymnasts/tabs/tab_physiological.html b/jarvis/people/templates/gymnasts/tabs/tab_physiological.html index 280f8aa..4f05737 100644 --- a/jarvis/people/templates/gymnasts/tabs/tab_physiological.html +++ b/jarvis/people/templates/gymnasts/tabs/tab_physiological.html @@ -3,7 +3,7 @@
    -

    Height/Weight

    +

    Height & Weight

    {% if height_weight_list %} @@ -76,7 +76,7 @@ Mechanism Location Side - Skill + Skill # Week Off @@ -92,7 +92,7 @@ {{ injury.get_mechanism_display }} {{ injury.location }} {{ injury.get_body_side_display }} - {% if injury.skill %}{{ injury.skill }}{% else %}-{% endif %} + {% if injury.skill %}{{ injury.skill.notation }}{% else %}-{% endif %} {{ injury.nb_week_off }} {% endfor %} @@ -234,12 +234,19 @@ gradient_stroke_green.addColorStop(0.5, 'rgba(75, 192, 192, 0.2)'); gradient_stroke_green.addColorStop(0.25, 'rgba(75, 192, 192, 0)'); - var border_color_4 = 'rgb(54, 162, 235)'; - var gradient_stroke_4 = ctx.createLinearGradient(0, 230, 0, 50); - gradient_stroke_4.addColorStop(1, 'rgba(54, 162, 235, 0.4)'); - gradient_stroke_4.addColorStop(0.75, 'rgba(54, 162, 235, 0.3)'); - gradient_stroke_4.addColorStop(0.5, 'rgba(54, 162, 235, 0.2)'); - gradient_stroke_4.addColorStop(0.25, 'rgba(54, 162, 235, 0)'); + var border_color_blue = 'rgb(54, 162, 235)'; + var gradient_stroke_blue = ctx.createLinearGradient(0, 230, 0, 50); + gradient_stroke_blue.addColorStop(1, 'rgba(54, 162, 235, 0.4)'); + gradient_stroke_blue.addColorStop(0.75, 'rgba(54, 162, 235, 0.3)'); + gradient_stroke_blue.addColorStop(0.5, 'rgba(54, 162, 235, 0.2)'); + gradient_stroke_blue.addColorStop(0.25, 'rgba(54, 162, 235, 0)'); + + var border_color_yellow = 'rgb(255, 205, 86)'; + var gradient_stroke_yellow = ctx.createLinearGradient(0, 230, 0, 50); + gradient_stroke_yellow.addColorStop(1, 'rgba(255, 205, 86, 0.4)'); + gradient_stroke_yellow.addColorStop(0.75, 'rgba(255, 205, 86, 0.3)'); + gradient_stroke_yellow.addColorStop(0.5, 'rgba(255, 205, 86, 0.2)'); + gradient_stroke_yellow.addColorStop(0.25, 'rgba(255, 205, 86, 0)'); var mindstate_values = [ {% for wellbeing in wellbeing_list %} @@ -318,12 +325,21 @@ { label: 'Fatigue', cubicInterpolationMode: 'monotone', - backgroundColor: gradient_stroke_4, - borderColor: border_color_4, - pointBackgroundColor: border_color_4, + backgroundColor: gradient_stroke_blue, + borderColor: border_color_blue, + pointBackgroundColor: border_color_blue, fill: true, data: fatigue_values, }, + { + label: 'Muscle', + cubicInterpolationMode: 'monotone', + backgroundColor: gradient_stroke_yellow, + borderColor: border_color_yellow, + pointBackgroundColor: border_color_yellow, + fill: true, + data: muscle_soreness_values, + }, ], };