Update wellbeing listing
This commit is contained in:
parent
ae7153565c
commit
0a42d3febf
|
@ -14,6 +14,7 @@ from .models import (
|
||||||
Injury,
|
Injury,
|
||||||
WellBeing,
|
WellBeing,
|
||||||
Intensity,
|
Intensity,
|
||||||
|
InjuryType,
|
||||||
HeightWeight,
|
HeightWeight,
|
||||||
LearnedSkill,
|
LearnedSkill,
|
||||||
ChronoDetails,
|
ChronoDetails,
|
||||||
|
@ -100,6 +101,14 @@ class InjuryLocationAdmin(admin.ModelAdmin):
|
||||||
search_fields = ("label",)
|
search_fields = ("label",)
|
||||||
|
|
||||||
|
|
||||||
|
class InjuryTypeAdmin(admin.ModelAdmin):
|
||||||
|
model = InjuryType
|
||||||
|
|
||||||
|
list_display = ("label",)
|
||||||
|
fields = ("label",)
|
||||||
|
search_fields = ("label",)
|
||||||
|
|
||||||
|
|
||||||
class InjuryAdmin(admin.ModelAdmin):
|
class InjuryAdmin(admin.ModelAdmin):
|
||||||
model = Injury
|
model = Injury
|
||||||
|
|
||||||
|
@ -307,6 +316,7 @@ admin.site.register(Chrono, ChronoAdmin)
|
||||||
admin.site.register(Injury, InjuryAdmin)
|
admin.site.register(Injury, InjuryAdmin)
|
||||||
admin.site.register(WellBeing, WellBeingAdmin)
|
admin.site.register(WellBeing, WellBeingAdmin)
|
||||||
admin.site.register(Intensity, IntensityAdmin)
|
admin.site.register(Intensity, IntensityAdmin)
|
||||||
|
admin.site.register(InjuryType, InjuryTypeAdmin)
|
||||||
admin.site.register(LearnedSkill, LearnedSkillAdmin)
|
admin.site.register(LearnedSkill, LearnedSkillAdmin)
|
||||||
admin.site.register(HeightWeight, HeightWeightAdmin)
|
admin.site.register(HeightWeight, HeightWeightAdmin)
|
||||||
admin.site.register(ChronoDetails, ChronoDetailsAdmin)
|
admin.site.register(ChronoDetails, ChronoDetailsAdmin)
|
||||||
|
|
|
@ -188,6 +188,7 @@ class InjuryForm(forms.ModelForm):
|
||||||
"gymnast",
|
"gymnast",
|
||||||
"date",
|
"date",
|
||||||
"mechanism",
|
"mechanism",
|
||||||
|
"injury_type",
|
||||||
"location",
|
"location",
|
||||||
"body_side",
|
"body_side",
|
||||||
"nb_week_off",
|
"nb_week_off",
|
||||||
|
@ -204,6 +205,7 @@ class InjuryForm(forms.ModelForm):
|
||||||
),
|
),
|
||||||
"gymnast": forms.HiddenInput(),
|
"gymnast": forms.HiddenInput(),
|
||||||
"skill": forms.HiddenInput(),
|
"skill": forms.HiddenInput(),
|
||||||
|
"injury_type": forms.Select(attrs={"class": "form-control selectpicker"}),
|
||||||
"mechanism": forms.Select(attrs={"class": "form-control selectpicker"}),
|
"mechanism": forms.Select(attrs={"class": "form-control selectpicker"}),
|
||||||
"location": forms.Select(attrs={"class": "form-control selectpicker"}),
|
"location": forms.Select(attrs={"class": "form-control selectpicker"}),
|
||||||
"body_side": 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(
|
"informations": forms.Textarea(
|
||||||
attrs={
|
attrs={
|
||||||
"class": "form-control",
|
"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
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,6 +161,21 @@ class InjuryLocation(models.Model):
|
||||||
return f"{self.label}"
|
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):
|
class Injury(Markdownizable, Seasonisable):
|
||||||
"""
|
"""
|
||||||
La classe `Injury` permet d'indiquer qu'un gymnaste a eu un blessure, en liaison avec un
|
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",
|
related_name="injuries",
|
||||||
on_delete=models.CASCADE,
|
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(
|
body_side = models.PositiveSmallIntegerField(
|
||||||
choices=INJURY_BODY_SIDE_CHOICE, verbose_name="Body side"
|
choices=INJURY_BODY_SIDE_CHOICE, verbose_name="Body side"
|
||||||
)
|
)
|
||||||
|
@ -369,6 +393,18 @@ class WellBeing(Markdownizable, Seasonisable):
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"{self.gymnast} - {self.date} : {self.mindstate} | {self.sleep} | {self.stress} | {self.fatigue} | {self.muscle_soreness}"
|
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):
|
class GymnastHasRoutine(models.Model):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -47,6 +47,13 @@
|
||||||
{% if form.mechanism.errors %} <span class="btn btn-sm btn-danger-outline">{% for error in form.mechanism.errors %}{{ error }}{% endfor %}</span>{% endif %}
|
{% if form.mechanism.errors %} <span class="btn btn-sm btn-danger-outline">{% for error in form.mechanism.errors %}{{ error }}{% endfor %}</span>{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group row ">
|
||||||
|
<label for="id_injury_type" class="col-4 col-sm-3 col-form-label">{{ form.injury_type.label }}<span class="text-danger"><b>*</b></span></label>
|
||||||
|
<div class="col-sm-8 col-md-6 col-lg-6 col-xl-6 {% if form.injury_type.errors %}has-danger{% endif %}">
|
||||||
|
{{ form.injury_type }}
|
||||||
|
{% if form.injury_type.errors %} <span class="btn btn-sm btn-danger-outline">{% for error in form.injury_type.errors %}{{ error }}{% endfor %}</span>{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="form-group row ">
|
<div class="form-group row ">
|
||||||
<label for="id_location" class="col-4 col-sm-3 col-form-label">{{ form.location.label }}<span class="text-danger"><b>*</b></span></label>
|
<label for="id_location" class="col-4 col-sm-3 col-form-label">{{ form.location.label }}<span class="text-danger"><b>*</b></span></label>
|
||||||
<div class="col-sm-8 col-md-6 col-lg-6 col-xl-6 {% if form.location.errors %}has-danger{% endif %}">
|
<div class="col-sm-8 col-md-6 col-lg-6 col-xl-6 {% if form.location.errors %}has-danger{% endif %}">
|
||||||
|
@ -69,8 +76,14 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group row ">
|
<div class="form-group row ">
|
||||||
<label for="id_information" class="col-4 col-sm-3 col-form-label">Informations</label>
|
<label for="id_diagnosis" class="col-4 col-sm-3 col-form-label">{{ form.diagnosis.label }}</label>
|
||||||
<div class="col-sm-9 col-md-9 col-lg-9 col-xl-9 {% if form.id_informations.errors %}has-danger{% endif %}">
|
<div class="col-sm-9 col-md-9 col-lg-9 col-xl-9 {% if form.id_diagnosis.errors %}has-danger{% endif %}">
|
||||||
|
{{ form.diagnosis }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group row ">
|
||||||
|
<label for="id_informations" class="col-4 col-sm-3 col-form-label">Commentaires</label>
|
||||||
|
<div class="col-sm-9 col-md-9 col-lg-9 col-xl-9 {% if form.informations.errors %}has-danger{% endif %}">
|
||||||
{{ form.informations }}
|
{{ form.informations }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -6,23 +6,19 @@
|
||||||
<div class="col-12 col-sm-8 col-md-6">
|
<div class="col-12 col-sm-8 col-md-6">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h4 class="card-title mb-0">Well being {{ wellbeing.date | date:"d N Y" }}</h4>
|
<h4 class="card-title mb-0"><a href="{% url 'gymnast_details_tab' wellbeing.gymnast.id 'physiological' %}">{{ wellbeing.gymnast }}</a>'s well being on {{ wellbeing.date | date:"j F Y" }}</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body text-center">
|
||||||
<a href="{% url 'gymnast_details_tab' wellbeing.gymnast.id 'physiological' %}">{{ wellbeing.gymnast }}</a><br />
|
|
||||||
Mindstate : {{ wellbeing.mindstate }}<br />
|
|
||||||
Sleep : {{ wellbeing.sleep }}<br />
|
|
||||||
Stress : {{ wellbeing.stress }}<br />
|
|
||||||
Fatigue : {{ wellbeing.fatigue }}<br />
|
|
||||||
Muscle soreness : {{ wellbeing.muscle_soreness }}<br />
|
|
||||||
<br />
|
|
||||||
{% if wellbeing.to_markdown %}
|
{% if wellbeing.to_markdown %}
|
||||||
{{ wellbeing.to_markdown | safe }}
|
{{ wellbeing.to_markdown | safe }}
|
||||||
{% else %}
|
{% else %}
|
||||||
<p class="text-muted">No additionnal details.</p>
|
<p class="text-muted">No additionnal details.</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div class="card-footer pl-0 pb-0">
|
<canvas id="chart_radar_wellbeing" class="chartjs" width="400" height="400"></canvas>
|
||||||
|
<p class="text-muted">Mindstate : {{ wellbeing.mindstate }} | Sleep : {{ wellbeing.sleep }} | Stress : {{ wellbeing.stress }} | Fatigue : {{ wellbeing.fatigue }} | Muscle soreness : {{ wellbeing.muscle_soreness }}</p>
|
||||||
|
</div>
|
||||||
|
<div class="card-footer">
|
||||||
<a href="{% url 'wellbeing_list' %}">
|
<a href="{% url 'wellbeing_list' %}">
|
||||||
<button type="submit" value="add" class="btn btn-icon btn-warning ">
|
<button type="submit" value="add" class="btn btn-icon btn-warning ">
|
||||||
<i class="tim-icons icon-double-left"></i>
|
<i class="tim-icons icon-double-left"></i>
|
||||||
|
@ -32,6 +28,57 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block footerscript %}
|
||||||
|
<script type="text/javascript">
|
||||||
|
var ctx = document.getElementById("chart_radar_wellbeing").getContext("2d");
|
||||||
|
|
||||||
|
const data = {
|
||||||
|
labels: [
|
||||||
|
'Mind State',
|
||||||
|
'Sleep',
|
||||||
|
'Zen',
|
||||||
|
'Rest',
|
||||||
|
'Muscle',
|
||||||
|
],
|
||||||
|
datasets: [{
|
||||||
|
data: [{{ wellbeing.mindstate }}, {{ wellbeing.sleep }}, {{ wellbeing.get_inversed_stress }}, {{ wellbeing.get_inversed_fatigue }}, {{ wellbeing.get_inversed_muscle_soreness }}],
|
||||||
|
fill: true,
|
||||||
|
backgroundColor: 'rgba(255, 99, 132, 0.2)',
|
||||||
|
borderColor: 'rgb(255, 99, 132)',
|
||||||
|
pointBackgroundColor: 'rgb(255, 99, 132)',
|
||||||
|
pointBorderColor: '#fff',
|
||||||
|
pointHoverBackgroundColor: '#fff',
|
||||||
|
pointHoverBorderColor: 'rgb(255, 99, 132)'
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
|
||||||
|
new Chart(ctx, {
|
||||||
|
responsive: true,
|
||||||
|
type: 'radar',
|
||||||
|
data: data,
|
||||||
|
options: {
|
||||||
|
elements: {
|
||||||
|
line: {
|
||||||
|
borderWidth: 3
|
||||||
|
}
|
||||||
|
},
|
||||||
|
scales: {
|
||||||
|
r: {
|
||||||
|
// angleLines: {
|
||||||
|
// display: false
|
||||||
|
// },
|
||||||
|
suggestedMin: 0,
|
||||||
|
suggestedMax: 10,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
plugins: {
|
||||||
|
legend: {
|
||||||
|
display: false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
|
@ -45,12 +45,34 @@
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td class="text-left"><a href="{% url 'wellbeing_details' wellbeing.id %}">{{ wellbeing.date | date:"d-m-Y" }}</a></td>
|
<td class="text-left"><a href="{% url 'wellbeing_details' wellbeing.id %}">{{ wellbeing.date | date:"d-m-Y" }}</a></td>
|
||||||
<td class="text-left"><a href="{% url 'gymnast_details_tab' wellbeing.gymnast.id 'physiological' %}">{{ wellbeing.gymnast }}</a></td>
|
<td class="text-left">
|
||||||
<td class="text-right">{{ wellbeing.mindstate }}</td>
|
<a href="{% url 'gymnast_details_tab' wellbeing.gymnast.id 'physiological' %}">
|
||||||
<td class="text-right">{{ wellbeing.sleep }}</td>
|
{{ wellbeing.gymnast }}</td>
|
||||||
<td class="text-right">{{ wellbeing.stress }}</td>
|
<td class="text-right">
|
||||||
<td class="text-right">{{ wellbeing.fatigue }}</td>
|
{% if wellbeing.mindstate < 5%}<b><span class="text-danger">{% endif %}
|
||||||
<td class="text-right">{{ wellbeing.muscle_soreness }}</td>
|
{{ wellbeing.mindstate }}
|
||||||
|
{% if wellbeing.mindstate < 5%}</b></span>{% endif %}
|
||||||
|
</td>
|
||||||
|
<td class="text-right">
|
||||||
|
{% if wellbeing.sleep < 5%}<b><span class="text-danger">{% endif %}
|
||||||
|
{{ wellbeing.sleep }}
|
||||||
|
{% if wellbeing.sleep < 5%}</b></span>{% endif %}
|
||||||
|
</td>
|
||||||
|
<td class="text-right">
|
||||||
|
{% if wellbeing.stress < 5%}<b><span class="text-danger">{% endif %}
|
||||||
|
{{ wellbeing.stress }}
|
||||||
|
{% if wellbeing.stress < 5%}</b></span>{% endif %}
|
||||||
|
</td>
|
||||||
|
<td class="text-right">
|
||||||
|
{% if wellbeing.fatigue < 5%}<b><span class="text-danger">{% endif %}
|
||||||
|
{{ wellbeing.fatigue }}
|
||||||
|
{% if wellbeing.fatigue < 5%}</b></span>{% endif %}
|
||||||
|
</td>
|
||||||
|
<td class="text-right">
|
||||||
|
{% if wellbeing.muscle_soreness < 5%}<b><span class="text-danger">{% endif %}
|
||||||
|
{{ wellbeing.muscle_soreness }}
|
||||||
|
{% if wellbeing.muscle_soreness < 5%}</b></span>{% endif %}
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -976,6 +976,7 @@ def wellbeing_create_or_update(
|
||||||
<li>Stress: {stress}</li>
|
<li>Stress: {stress}</li>
|
||||||
<li>Fatigue: {fatigue}</li>
|
<li>Fatigue: {fatigue}</li>
|
||||||
<li>Muscle_soreness: {muscle_soreness}</li>
|
<li>Muscle_soreness: {muscle_soreness}</li>
|
||||||
|
</ul>
|
||||||
</p><br />
|
</p><br />
|
||||||
<p>Excellente journée</p><p>Jarvis</p>""",
|
<p>Excellente journée</p><p>Jarvis</p>""",
|
||||||
)
|
)
|
||||||
|
|
|
@ -74,6 +74,7 @@
|
||||||
<th style="width: 3%"></th>
|
<th style="width: 3%"></th>
|
||||||
<th class="header text-center" style="width: 10%">Date</th>
|
<th class="header text-center" style="width: 10%">Date</th>
|
||||||
<th class="header text-left" style="width: 10%">Mechanism</th>
|
<th class="header text-left" style="width: 10%">Mechanism</th>
|
||||||
|
<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: 25%">Location</th>
|
||||||
<th class="header text-left" style="width: 10%">Side</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: 15%">Skill</th>
|
||||||
|
@ -90,6 +91,7 @@
|
||||||
</td>
|
</td>
|
||||||
<td class="text-center"><a href="{% url 'injury_details' injury.id %}">{{ injury.date | date:"d-m-Y" }}</a></td>
|
<td class="text-center"><a href="{% url 'injury_details' injury.id %}">{{ injury.date | date:"d-m-Y" }}</a></td>
|
||||||
<td class="text-left">{{ injury.get_mechanism_display }}</td>
|
<td class="text-left">{{ injury.get_mechanism_display }}</td>
|
||||||
|
<td class="text-left">{{ injury.type }}</td>
|
||||||
<td class="text-left">{{ injury.location }}</td>
|
<td class="text-left">{{ injury.location }}</td>
|
||||||
<td class="text-left">{{ injury.get_body_side_display }}</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.notation }}</a>{% else %}-{% endif %}</td>
|
||||||
|
|
|
@ -38,13 +38,13 @@
|
||||||
<div class="col-md-6 pl-1">
|
<div class="col-md-6 pl-1">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h4>Chrono</h4>
|
<h4>Chronos</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body pt-0 pb-0 pr-0 pl-0">
|
<div class="card-body pt-0 pb-0 pr-0 pl-0">
|
||||||
{% if chrono_list %}
|
{% if chrono_list %}
|
||||||
<div><canvas id="chart_chrono" class="chartjs" width="400" height="200"></canvas></div>
|
<div><canvas id="chart_chrono" class="chartjs" width="400" height="200"></canvas></div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<p class="pl-3 text-muted">No chrono recorded for this gymnast.</p>
|
<p class="pl-3 text-muted">No chrono recorded yet for this gymnast.</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="card-footer pt-0 row">
|
<div class="card-footer pt-0 row">
|
||||||
|
|
Loading…
Reference in New Issue