Revert "Minor modificatin"

This reverts commit ae7153565c.
This commit is contained in:
Gregory Trullemans 2023-10-11 12:13:33 +02:00
parent 0a42d3febf
commit 9eb5c9304e
13 changed files with 36 additions and 116 deletions

View File

@ -121,21 +121,14 @@ class InjuryAdmin(admin.ModelAdmin):
"mechanism",
"nb_week_off",
"informations",
)
) # educative
readonly_fields = ("season", "week_number", "created_at", "updated_at")
list_display = (
"date",
"gymnast",
"mechanism",
"location",
"body_side",
"nb_week_off",
)
list_display = ("date", "gymnast", "skill") # educative
list_filter = (
("gymnast", RelatedDropdownFilter),
("mechanism", DropdownFilter),
("location", RelatedDropdownFilter),
("body_side", DropdownFilter),
("mechanism", DropdownFilter),
)
date_hierarchy = "date"
search_fields = ("date", "gymnast") # educative

View File

@ -192,7 +192,6 @@ class InjuryForm(forms.ModelForm):
"location",
"body_side",
"nb_week_off",
"diagnosis",
"informations",
)
widgets = {
@ -212,16 +211,10 @@ 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: consequencies, re-education exercices, …", # pylint: disable=line-too-long
"placeholder": "Informations about injury: context (why, where, …), consequencies, re-education exercices, …", # pylint: disable=line-too-long
}
),
}

View File

@ -15,6 +15,7 @@ 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",
@ -23,5 +24,6 @@ class Migration(migrations.Migration):
null=True,
blank=True,
),
# preserve_default=False,
),
]

View File

@ -1,24 +0,0 @@
# 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",
),
),
]

View File

@ -1,23 +0,0 @@
# 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",
),
),
]

View File

@ -223,12 +223,6 @@ 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"
)
@ -236,10 +230,10 @@ class Injury(Markdownizable, Seasonisable):
updated_at = models.DateTimeField(auto_now=True)
def __str__(self):
return f"{self.gymnast} ({self.date}): {self.mechanism} on {self.location} {self.body_side}"
return f"{self.gymnast} ({self.date})"
def timeline_representation(self):
return f"<li>{self.date:%d %b %Y} - Injury ({self.skill}): {self.nb_week_off} (weeks off)</li>"
return f"<li>{self.date:%d %b %Y} - Accident ({self.skill}): {self.nb_week_off} (weeks off)</li>"
class LearnedSkill(Seasonisable):

View File

@ -7,7 +7,7 @@
<div class="col-12 col-sm-12 col-md-8 col-lg-6 col-xl-6">
<div class="card">
<div class="card-header">
<h4 class="">{% if heightweight_id %}Edit{% else %}Add{% endif %} height & weight</h4>
<h4 class="">{% if heightweight_id %}Edit{% else %}Add{% endif %} height/weight couple</h4>
</div>
<div class="card-body">
{% if form.errors %}

View File

@ -7,7 +7,7 @@
<div class="card">
<div class="card-header row">
<div class="col-8">
<h4 class="">Height & Weight list {% if gymnast %}for <a href="{% url 'gymnast_details_tab' gymnast.id 'physiological' %}"><i>{{ gymnast }}</i></a>{% endif %}</h4>
<h4 class="">Height/Weight list {% if gymnast %}for <a href="{% url 'gymnast_details_tab' gymnast.id 'physiological' %}"><i>{{ gymnast }}</i></a>{% endif %}</h4>
</div>
<div class="col-1 ml-auto">
<div class="text-right">

View File

@ -30,7 +30,7 @@
<th class="header text-left" style="width: 9%">Mechanism</th>
<th class="header text-left" style="width: 20%">Location</th>
<th class="header text-left" style="width: 8%">Side</th>
<th style="width: 12%">Skill</th>
<th style="width: 20%">Skill</th>
<th style="width: 8%"># Week off</th>
</tr>
</thead>
@ -49,7 +49,7 @@
<td class="text-left">{{ injury.get_body_side_display }}</td>
<td class="text-left">
{% if injury.skill %}
<a href="{% url 'skill_details' injury.skill.id %}">{{ injury.skill.notation }}</a>
<a href="{% url 'skill_details' injury.skill.id %}">{{ injury.skill }}</a>
{% else %}
-
{% endif %}

View File

@ -54,8 +54,8 @@
{{ form.mindstate }}
{% if form.mindstate.errors %}&nbsp;<span class="btn btn-sm btn-danger-outline">{% for error in form.mindstate.errors %}{{ error }}{% endfor %}</span>{% endif %}
</div>
<div class="col-4 col-sm-3 col-md-5 c ol-lg-5">
<h3 class="card-category text-muted">(1: Very Bad - 10: Very Good)</h3>
<div class="col-4 col-sm-3 col-md-5 col-lg-5">
<p class="text-muted">(1: Very Bad - 10: Very Good)</p>
</div>
</div>
<div class="form-group row ">
@ -65,7 +65,7 @@
{% if form.sleep.errors %}&nbsp;<span class="btn btn-sm btn-danger-outline">{% for error in form.sleep.errors %}{{ error }}{% endfor %}</span>{% endif %}
</div>
<div class="col-4 col-sm-3 col-md-5 col-lg-5">
<h3 class="card-category text-muted">(1: Very Bad - 10: Very Good)</h3>
<p class="text-muted">(1: Very Bad - 10: Very Good)</p>
</div>
</div>
<div class="form-group row ">
@ -75,7 +75,7 @@
{% if form.stress.errors %}&nbsp;<span class="btn btn-sm btn-danger-outline">{% for error in form.stress.errors %}{{ error }}{% endfor %}</span>{% endif %}
</div>
<div class="col-4 col-sm-3 col-md-5 col-lg-5">
<h3 class="card-category text-muted">(1: Very Low - 10: Very High)</h3>
<p class="text-muted">(1: Very Low - 10: Very High)</p>
</div>
</div>
<div class="form-group row ">
@ -85,7 +85,7 @@
{% if form.fatigue.errors %}&nbsp;<span class="btn btn-sm btn-danger-outline">{% for error in form.fatigue.errors %}{{ error }}{% endfor %}</span>{% endif %}
</div>
<div class="col-4 col-sm-3 col-md-5 col-lg-5">
<h3 class="card-category text-muted">(1: Very Low - 10: Very High)</h3>
<p class="text-muted">(1: Very Low - 10: Very High)</p>
</div>
</div>
<div class="form-group row ">
@ -95,7 +95,7 @@
{% if form.muscle_soreness.errors %}&nbsp;<span class="btn btn-sm btn-danger-outline">{% for error in form.muscle_soreness.errors %}{{ error }}{% endfor %}</span>{% endif %}
</div>
<div class="col-4 col-sm-3 col-md-5 col-lg-5">
<h3 class="card-category text-muted">(1: Very Low - 10: Very High)</h3>
<p class="text-muted">(1: Very Low - 10: Very High)</p>
</div>
</div>
<div class="form-group row ">

View File

@ -1471,7 +1471,9 @@ def season_information_create_or_update(
)
)
else:
return render(request, "seasoninformations/create.html", {"form": form})
return render(
request, "followup/seasoninformations/create.html", {"form": form}
)
form = SeasonInformationForm(instance=season_information, initial=data)
context = {"form": form, "season_information_id": season_information_id}

View File

@ -25,7 +25,7 @@
</a>
<p class="description">
{{ last_season_information.club.name }}<br />
<b>{{ gymnast.birthdate.year }} - {{ last_season_information.get_category_display }}</b>
<b>{{ last_season_information.get_category_display }}</b>
</p>
</div>
<div class="card-description">
@ -35,8 +35,7 @@
{% if height_weight %}
<b>{{ height_weight.0.height }}cm - {{ height_weight.0.weight }}kg</b> ({{ height_weight.0.date | date:"d-m-Y" }})<br />
{% endif %}
Training: <b>{{ last_season_information.number_of_training_sessions_per_week }}/week</b> ({{ last_season_information.number_of_hours_per_week }} hours)<br />
S&C: <b>{{ last_season_information.number_of_s_and_c_sessions_per_week }}/week</b>({{ last_season_information.number_of_s_and_c_hours_per_week }} hours)<br />
<b>{{ last_season_information.number_of_training_sessions_per_week }} training/week</b> for <b>{{ last_season_information.number_of_hours_per_week }} hours/week</b><br />
<br />
{% if user_is_trainer and gymnast.informations %}
<p>{{ gymnast.to_markdown | safe }}</p>
@ -46,7 +45,7 @@
<b>10 |</b> : {% if best_straightjump %}<b>{{ best_straightjump.0.tof }}</b> ({{ best_straightjump.0.date | date:"d-m-Y" }}){% else %} <span class="text-muted">(no information)</span>{% endif %}
</li>
<li>
<b>Q1R1</b> : {% if best_routine %}<b>{{ best_routine.0.tof }}</b> ({{ best_routine.0.date | date:"d-m-Y" }}){% else %} <span class="text-muted">(no information)</span>{% endif %}
<b>Routine</b> : {% if best_routine %}<b>{{ best_routine.0.tof }}</b> ({{ best_routine.0.date | date:"d-m-Y" }}){% else %} <span class="text-muted">(no information)</span>{% endif %}
</li>
{% if user_is_trainer %}
<a href="{% url 'add_season_information_for_gymnast' gymnast.id %}">Add season details</a> -

View File

@ -3,7 +3,7 @@
<div class="col-md-6">
<div class="card mb-4">
<div class="card-header">
<h4>Height & Weight</h4>
<h4>Height/Weight</h4>
</div>
<div class="card-body pt-0 pb-0 pr-0 pl-0">
{% if height_weight_list %}
@ -77,7 +77,7 @@
<th class="header text-left" style="width: 10%">Type</th>
<th class="header text-left" style="width: 25%">Location</th>
<th class="header text-left" style="width: 10%">Side</th>
<th class="header text-left" style="width: 15%">Skill</th>
<th class="header text-left" style="width: 25%">Skill</th>
<th class="header text-center" style="width: 10%"># Week Off</th>
</tr>
</thead>
@ -94,7 +94,7 @@
<td class="text-left">{{ injury.type }}</td>
<td class="text-left">{{ injury.location }}</td>
<td class="text-left">{{ injury.get_body_side_display }}</td>
<td class="text-left">{% if injury.skill %}<a href="{% url 'skill_details' injury.skill.id %}">{{ injury.skill.notation }}</a>{% else %}-{% endif %}</td>
<td class="text-left">{% if injury.skill %}<a href="{% url 'skill_details' injury.skill.id %}">{{ injury.skill }}</a>{% else %}-{% endif %}</td>
<td class="text-center">{{ injury.nb_week_off }}</td>
</tr>
{% endfor %}
@ -236,19 +236,12 @@
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_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 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 mindstate_values = [
{% for wellbeing in wellbeing_list %}
@ -327,21 +320,12 @@
{
label: 'Fatigue',
cubicInterpolationMode: 'monotone',
backgroundColor: gradient_stroke_blue,
borderColor: border_color_blue,
pointBackgroundColor: border_color_blue,
backgroundColor: gradient_stroke_4,
borderColor: border_color_4,
pointBackgroundColor: border_color_4,
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,
},
],
};