Remove unused method, change average quality, …

This commit is contained in:
Gregory Trullemans 2024-02-02 11:44:53 +01:00
parent 0a4532b955
commit bbedfb6b52
9 changed files with 167 additions and 470 deletions

View File

@ -563,17 +563,14 @@ class Intensity(Markdownizable, Seasonisable):
- qualité du nombre de passage
- qualité moyenne
Elle va également calculer 6 statistiques :
- la difficulté moyenne par passage (diff/pass)
- la difficulté moyenne par figure (diff/skill)
- la quantité moyenne de figures par passage (skill/pass)
- la quantité moyenne de figure par minute (skill/time)
- le temps moyen par passage (time/pass)
- le temps moyen par figure (time/skill)
TODO:
- trouver un calcul d'efficacité qui tienne compte des dépassements (100%+)
- trouver un calcul d'efficacité qui tienne compte des statistiques (notamment le temps par passage)
Elle va également calculer 6 statistiques (et/ou leur corollaire) :
- la difficulté moyenne par minute (d/T)
- la quantité moyenne de figure par minute (S/T)
- le temps moyen par passage (T/p)
- le temps moyen par figure (T/S) (corollaire de la 2ème)
- la difficulté moyenne par passage (d/p)
- la difficulté moyenne par figure (d/S)
- la quantité moyenne de figures par passage (S/p)
"""
class Meta:
@ -601,6 +598,7 @@ class Intensity(Markdownizable, Seasonisable):
def __str__(self):
return f"{self.gymnast} - {self.date} : {self.time} - {self.difficulty} - {self.quantity_of_skill} - {self.number_of_passes}" # pylint: disable=line-too-long
# Quality
@property
def time_quality(self):
return (self.time / self.theorical_time) * 100
@ -619,6 +617,55 @@ class Intensity(Markdownizable, Seasonisable):
@property
def average_quality(self):
"""
Calcul de la qualité d'un entrainement sur base des 4 données pratiques encodées : Temps,
# de passage, # de saut et Difficulté.
Si les 4 données pratiques sont inférieures ou égales aux données théoriques, une moyenne
pondérée (D*4, p*3, S*2 et T) est calculée.
Si une (ou plusieurs) données pratiques sont supérieures aux données théorique... ?
Pour les cas non traités, une moyenne arithmétique est calculée.
TODO:
- trouver un calcul d'efficacité qui tienne compte des statistiques (notamment le temps par passage)
"""
# Si les 4 données pratiques sont inférieures ou égales aux données théoriques, une moyenne
# pondérée (D*4, p*3, S*2 et T) est calculée.
if (
self.time <= self.theorical_time
and self.number_of_passes <= self.number_of_passes_asked
and self.difficulty <= self.difficulty_asked
and self.quantity_of_skill <= self.quantity_of_skill_asked
):
return (
self.time_quality
+ (self.quantity_of_skill_quality * 2)
+ (self.number_of_passes_quality * 3)
+ (self.difficulty_quality * 4)
) / 10
# if self.difficulty > self.difficulty_asked:
# if (
# self.time <= self.theorical_time
# and self.number_of_passes <= self.number_of_passes_asked
# and self.quantity_of_skill <= self.quantity_of_skill_asked
# ):
# return self.difficulty_quality
if (
self.time <= self.theorical_time
and self.number_of_passes <= self.number_of_passes_asked
):
if (
self.difficulty >= self.difficulty_asked
and self.quantity_of_skill >= self.quantity_of_skill_asked
):
return (
(self.difficulty_quality * 2) + self.quantity_of_skill_quality
) / 3
# Pour les cas non traités, une moyenne arithmétique est calculée.
return (
self.time_quality
+ self.difficulty_quality
@ -626,6 +673,32 @@ class Intensity(Markdownizable, Seasonisable):
+ self.number_of_passes_quality
) / 4
# Theorical statistics
@property
def mean_time_by_passe_theorical(self):
return self.theorical_time / self.number_of_passes_asked
@property
def mean_quantity_of_skill_by_time_theorical(self):
return self.quantity_of_skill_asked / self.theorical_time
@property
def mean_time_by_skill_theorical(self):
return self.theorical_time / self.quantity_of_skill_asked
@property
def mean_difficulty_by_passe_theorical(self):
return self.difficulty_asked / self.number_of_passes_asked
@property
def mean_quantity_of_skill_by_passe_theorical(self):
return self.quantity_of_skill_asked / self.number_of_passes_asked
@property
def mean_difficulty_by_skill_theorical(self):
return self.difficulty_asked / self.quantity_of_skill_asked
# Real statistics
@property
def mean_time_by_passe(self):
return self.time / self.number_of_passes
@ -634,28 +707,20 @@ class Intensity(Markdownizable, Seasonisable):
def mean_time_by_skill(self):
return self.time / self.quantity_of_skill
@property
def difficulty_in_unit(self):
return self.difficulty / 10
@property
def difficulty_asked_in_unit(self):
return self.difficulty_asked / 10
@property
def mean_difficulty_by_passe(self):
return self.difficulty / self.number_of_passes
@property
def mean_difficulty_by_passe_in_unit(self):
return (self.difficulty / 10) / self.number_of_passes
return self.mean_difficulty_by_passe / 10
@property
def mean_quantity_of_skill_by_time(self):
return self.quantity_of_skill / self.time
@property
def quantity_of_skill_by_passe(self):
def mean_quantity_of_skill_by_passe(self):
return self.quantity_of_skill / self.number_of_passes
@property
@ -664,7 +729,16 @@ class Intensity(Markdownizable, Seasonisable):
@property
def mean_difficulty_by_skill_in_unit(self):
return (self.difficulty / 10) / self.quantity_of_skill
return self.mean_difficulty_by_skill / 10
# Human readeable scores
@property
def difficulty_in_unit(self):
return self.difficulty / 10
@property
def difficulty_asked_in_unit(self):
return self.difficulty_asked / 10
class SeasonInformation(models.Model):

View File

@ -14,7 +14,7 @@
{% csrf_token %}
<div class="form-group row ">
<label for="id_gymnast" class="col-4 col-sm-3 col-form-label">Gymnast <span class="text-danger"><b>*</b></span></label>
<div class="col-8 col-sm-9 col-md-9 col-lg-6 col-lg-4 col-xl-4 {% if form.jumper.errors %}has-danger{% endif %}">
<div class="col-8 col-sm-9 col-md-9 col-lg-6 col-lg-6 col-xl-6 {% if form.jumper.errors %}has-danger{% endif %}">
{% if request.user|has_group:"trainer" %}
{{ form.gymnast }}
{{ form.gymnast_related }}
@ -34,21 +34,21 @@
</div>
<div class="form-group row ">
<label for="id_chrono_type" class="col-4 col-sm-3 col-form-label">Chrono Type <span class="text-danger"><b>*</b></span></label>
<div class="col-5 col-sm-3 col-md-4 col-lg-4 col-xl-4 {% if form.chrono_type.errors %}has-danger{% endif %}">
<div class="col-4 col-sm-3 col-md-4 col-lg-4 col-xl-4 {% if form.chrono_type.errors %}has-danger{% endif %}">
{{ form.chrono_type }}
{% if form.chrono_type.errors %}&nbsp;<span class="btn btn-sm btn-danger-outline">{% for error in form.chrono_type.errors %}{{ error }}{% endfor %}</span>{% endif %}
</div>
</div>
<div class="form-group row ">
<label for="id_score_type" class="col-4 col-sm-3 col-form-label">Score Type <span class="text-danger"><b>*</b></span></label>
<div class="col-5 col-sm-3 col-md-4 col-lg-4 col-xl-4 {% if form.score_type.errors %}has-danger{% endif %}">
<div class="col-4 col-sm-3 col-md-4 col-lg-4 col-xl-4 {% if form.score_type.errors %}has-danger{% endif %}">
{{ form.score_type }}
{% if form.score_type.errors %}&nbsp;<span class="btn btn-sm btn-danger-outline">{% for error in form.score_type.errors %}{{ error }}{% endfor %}</span>{% endif %}
</div>
</div>
<div class="form-group row ">
<label for="id_score" class="col-4 col-sm-3 col-form-label">Score <span class="text-danger"><b>*</b></span></label>
<div class="col-4 col-sm-3 col-md-4 col-lg-3 {% if form.score.errors %}has-danger{% endif %}">
<div class="col-3 col-sm-3 col-md-4 col-lg-3 {% if form.score.errors %}has-danger{% endif %}">
{{ form.score }}
{% if form.score.errors %}&nbsp;<span class="btn btn-sm btn-danger-outline">{% for error in form.score.errors %}{{ error }}{% endfor %}</span>{% endif %}
</div>

View File

@ -48,13 +48,13 @@
<div class="col-sm-2 d-none d-sm-block"></div>
<div class="col-4 col-sm-3 pr-0">Skill</div>
<div class="col-2 text-right pl-0">
{% if intensity.quantity_of_skill_quality < 85.0 %}
<span class="text-danger">{{ intensity.quantity_of_skill_quality | floatformat:1 }}%</span>
{% elif intensity.quantity_of_skill_quality < 95.0 %}
<span class="text-warning">{{ intensity.quantity_of_skill_quality | floatformat:1 }}%</span>
{% else %}
<span class="text-success">{{ intensity.quantity_of_skill_quality | floatformat:1 }}%</span>
{% endif %}
{% if intensity.quantity_of_skill_quality < 85.0 %}
<span class="text-danger">{{ intensity.quantity_of_skill_quality | floatformat:1 }}%</span>
{% elif intensity.quantity_of_skill_quality < 95.0 %}
<span class="text-warning">{{ intensity.quantity_of_skill_quality | floatformat:1 }}%</span>
{% else %}
<span class="text-success">{{ intensity.quantity_of_skill_quality | floatformat:1 }}%</span>
{% endif %}
</div>
@ -63,13 +63,13 @@
<div class="col-sm-2 d-none d-sm-block"></div>
<div class="col-4 col-sm-3 pr-0">Passes</div>
<div class="col-2 text-right pl-0">
{% if intensity.number_of_passes_quality < 85.0 %}
<span class="text-danger">{{ intensity.number_of_passes_quality | floatformat:1 }}%</span>
{% elif intensity.number_of_passes_quality < 95.0 %}
<span class="text-warning">{{ intensity.number_of_passes_quality | floatformat:1 }}%</span>
{% else %}
<span class="text-success">{{ intensity.number_of_passes_quality | floatformat:1 }}%</span>
{% endif %}
{% if intensity.number_of_passes_quality < 85.0 %}
<span class="text-danger">{{ intensity.number_of_passes_quality | floatformat:1 }}%</span>
{% elif intensity.number_of_passes_quality < 95.0 %}
<span class="text-warning">{{ intensity.number_of_passes_quality | floatformat:1 }}%</span>
{% else %}
<span class="text-success">{{ intensity.number_of_passes_quality | floatformat:1 }}%</span>
{% endif %}
</div>
@ -94,7 +94,7 @@
<div class="col-4 col-sm-3 pr-0">Skill/passe</div>
<div class="col-2 text-right pl-0">
<b>
{{ intensity.quantity_of_skill_by_passe | floatformat:3 }}
{{ intensity.mean_quantity_of_skill_by_passe | floatformat:3 }}
</b>
</div>
<div class="col-sm-2 d-none d-sm-block"></div>

View File

@ -88,7 +88,7 @@
<td class="text-right">{{ intensity.mean_difficulty_by_passe_in_unit | floatformat:2 }}</td><!-- Difficulty by passe -->
<td class="text-right"><!-- # skill by passe -->
<b>
{{ intensity.quantity_of_skill_by_passe | floatformat:2 }}
{{ intensity.mean_quantity_of_skill_by_passe | floatformat:2 }}
</b>
</td>
<td class="text-right">{{ intensity.mean_difficulty_by_skill_in_unit | floatformat:2 }}</td><!-- Difficulty by skill -->

View File

@ -113,7 +113,7 @@
{% endif %}
<li class="nav-item">
<a class="nav-link get-info{% if tab == 'event' %} active{% endif %}" data-toggle="tab" href="#event" data-ref="#event" data-url="event/" id="display_event">
<a class="nav-link get-info{% if tab == 'event' %} active{% endif %} mr-2 mb-1" data-toggle="tab" href="#event" data-ref="#event" data-url="event/" id="display_event">
<i class="fal fa-calendar-day"></i> <!-- Events -->
</a>
</li>

View File

@ -1,388 +0,0 @@
{% load static %}
<div class="row justify-content-center ml-1">
<div class="col-md-6">
<div class="card mb-4">
<div class="card-header">
<h4>Height/Weight</h4>
</div>
<div class="card-body pt-0 pb-0 pr-0 pl-0">
{% if height_weight_list %}
<div><canvas id="chart_height_weight" class="chartjs" width="400" height="200"></canvas></div>
{% else %}
<p class="pl-3 text-muted">No height/weight recorded for this gymnast.</p>
{% endif %}
</div>
<div class="card-footer text-right text-muted pt-0">
{% if height_weight_list %}
<a href="{% url 'heightweight_list_for_gymnast' gymnast_id %}">
<button type="submit" value="add" class="btn btn-icon btn-warning ">
<i class="fal fa-line-height"></i>
</button>
</a>
{% endif %}
<a href="{% url 'heightweight_create_for_gymnast' gymnast_id %}">
<button type="submit" value="add" class="btn btn-icon btn-warning ">
<i class="fas fa-plus"></i>
</button>
</a>
</div>
</div>
</div>
<div class="col-md-6">
<div class="card mb-4">
<div class="card-header">
<h4>Well Being</h4>
</div>
<div class="card-body pt-0 pb-0 pr-0 pl-0">
{% if wellbeing_list %}
<div><canvas id="chart_wellbeing" class="chartjs" width="400" height="200"></canvas></div>
{% else %}
<p class="pl-3 text-muted">No well being recorded for this gymnast.</p>
{% endif %}
</div>
<div class="card-footer text-right text-muted pt-0">
{% if wellbeing_list %}
<a href="{% url 'wellbeing_list_for_gymnast' gymnast_id %}">
<button type="submit" value="add" class="btn btn-icon btn-warning ">
<i class="fal fa-file-medical-alt"></i>
</button>
</a>
{% endif %}
<a href="{% url 'wellbeing_create_for_gymnast' gymnast_id %}">
<button type="submit" value="add" class="btn btn-icon btn-warning ">
<i class="fas fa-plus"></i>
</button>
</a>
</div>
</div>
</div>
</div>
<div class="row justify-content-center ml-1">
<div class="col-md-12">
<div class="card">
<div class="card-header">
<h4>Injuries</h4>
</div>
<div class="card-body pt-0 pb-0">
{% if injuries_list %}
<table class="table tablesorter table-striped table-condensed" id="injury_table">
<thead>
<tr>
<th style="width: 2%"></th>
<th class="header text-center" style="width: 8%">Date</th>
<th class="header text-left" style="width: 8%">Mechanism</th>
<th class="header text-left" style="width: 27%">Type</th>
<th class="header text-left" style="width: 25%">Location</th>
<th class="header text-left" style="width: 12%">Side</th>
<th class="header text-left" style="width: 10%">Skill</th>
<th class="header text-left" style="width: 12%"># Week Off</th>
</tr>
</thead>
<tbody>
{% for injury in injuries_list %}
<tr>
<td class="text-left">
<a href="{% url 'injury_update' injury.id %}">
&nbsp;<span class="tim-icons icon-pencil text-warning"></span>
</a>
</td>
<td class="text-right"><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_injury_type_display }}</td>
<td class="text-left">{{ injury.get_location_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 }}</a>{% else %}-{% endif %}</td>
<td class="text-center">{{ injury.nb_week_off }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p class="text-muted">No injury known for this gymnast.</p>
{% endif %}
</div>
<div class="card-footer text-right text-muted pt-0">
<a href="{% url 'injury_create_for_gymnast' gymnast_id %}">
<button type="submit" value="add" class="btn btn-icon btn-warning ">
<i class="fas fa-plus"></i>
</button>
</a>
</div>
</div>
</div>
</div>
<script src="{% static "js/template_users/chart_gradient_color.js" %}"></script>
<script type="text/javascript">
var timeFormat = 'DD-MM-YYYY';
$('#injury_table').tablesorter({
headers: {
0: { sorter: false },
},
dateFormat: "uk",
sortList: [[1, 1]]
});
{% if height_weight_list %}
var ctx = document.getElementById("chart_height_weight").getContext("2d");
var border_color_pink = 'rgb(255, 99, 132)';
var gradient_stroke_pink = ctx.createLinearGradient(0, 230, 0, 50);
gradient_stroke_pink.addColorStop(1, 'rgba(255, 99, 132, 0.4)');
gradient_stroke_pink.addColorStop(0.75, 'rgba(255, 99, 132, 0.3)');
gradient_stroke_pink.addColorStop(0.5, 'rgba(255, 99, 132, 0.2)');
gradient_stroke_pink.addColorStop(0.25, 'rgba(255, 99, 132, 0)');
var border_color_orange = 'rgb(255, 159, 64)';
var gradient_stroke_orange = ctx.createLinearGradient(0, 230, 0, 50);
gradient_stroke_orange.addColorStop(1, 'rgba(255, 159, 64, 0.4)');
gradient_stroke_orange.addColorStop(0.75, 'rgba(255, 159, 64, 0.3)');
gradient_stroke_orange.addColorStop(0.5, 'rgba(255, 159, 64, 0.2)');
gradient_stroke_orange.addColorStop(0.25, 'rgba(255, 159, 64, 0)');
var height_values = [
{% for height_weight in height_weight_list %}
{
x: '{{ height_weight.date | date:"d-m-Y" }}',
y: '{{ height_weight.weight }}'
},
{% endfor %}
]
var weight_values = [
{% for height_weight in height_weight_list %}
{
x: '{{ height_weight.date | date:"d-m-Y" }}',
y: '{{ height_weight.height | add:"-100" }}'
},
{% endfor %}
]
var height_weight_data = {
datasets: [
{
label: 'Weight',
cubicInterpolationMode: 'monotone',
backgroundColor: gradient_stroke_pink,
borderColor: border_color_pink,
pointBackgroundColor: border_color_pink,
fill: true,
data: height_values,
},
{
label: 'Height',
cubicInterpolationMode: 'monotone',
backgroundColor: gradient_stroke_orange,
borderColor: border_color_orange,
pointBackgroundColor: border_color_orange,
fill: true,
data: weight_values
},
],
};
new Chart(ctx, {
responsive: true,
type: 'line',
data: height_weight_data,
options: {
scales: {
x: {
type: 'time',
display: true,
scaleLabel: {
display: true,
labelString: 'Date',
ticks: {
autoSkip: true,
source: 'data',
},
},
time: {
parser: timeFormat,
tooltipFormat: 'LL',
round: 'day',
},
},
},
plugins: {
legend: {
display: true,
position: 'bottom',
}
}
},
});
{% endif %}
{% if wellbeing_list %}
var ctx = document.getElementById("chart_wellbeing").getContext("2d");
var border_color_pink = 'rgb(255, 99, 132)';
var gradient_stroke_pink = ctx.createLinearGradient(0, 230, 0, 50);
gradient_stroke_pink.addColorStop(1, 'rgba(255, 99, 132, 0.4)');
gradient_stroke_pink.addColorStop(0.75, 'rgba(255, 99, 132, 0.3)');
gradient_stroke_pink.addColorStop(0.5, 'rgba(255, 99, 132, 0.2)');
gradient_stroke_pink.addColorStop(0.25, 'rgba(255, 99, 132, 0)');
var border_color_orange = 'rgb(255, 159, 64)';
var gradient_stroke_orange = ctx.createLinearGradient(0, 230, 0, 50);
gradient_stroke_orange.addColorStop(1, 'rgba(255, 159, 64, 0.4)');
gradient_stroke_orange.addColorStop(0.75, 'rgba(255, 159, 64, 0.3)');
gradient_stroke_orange.addColorStop(0.5, 'rgba(255, 159, 64, 0.2)');
gradient_stroke_orange.addColorStop(0.25, 'rgba(255, 159, 64, 0)');
var border_color_green = 'rgb(75, 192, 192)';
var gradient_stroke_green = ctx.createLinearGradient(0, 230, 0, 50);
gradient_stroke_green.addColorStop(1, 'rgba(75, 192, 192, 0.4)');
gradient_stroke_green.addColorStop(0.75, 'rgba(75, 192, 192, 0.3)');
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 mindstate_values = [
{% for wellbeing in wellbeing_list %}
{
x: '{{ wellbeing.date | date:"d-m-Y" }}',
y: '{{ wellbeing.mindstate }}'
},
{% endfor %}
];
var sleep_values = [
{% for wellbeing in wellbeing_list %}
{
x: '{{ wellbeing.date | date:"d-m-Y" }}',
y: '{{ wellbeing.sleep }}'
},
{% endfor %}
];
var stress_values = [
{% for wellbeing in wellbeing_list %}
{
x: '{{ wellbeing.date | date:"d-m-Y" }}',
y: '{{ wellbeing.stress }}'
},
{% endfor %}
];
var fatigue_values = [
{% for wellbeing in wellbeing_list %}
{
x: '{{ wellbeing.date | date:"d-m-Y" }}',
y: '{{ wellbeing.fatigue }}'
},
{% endfor %}
];
var muscle_soreness_values = [
{% for wellbeing in wellbeing_list %}
{
x: '{{ wellbeing.date | date:"d-m-Y" }}',
y: '{{ wellbeing.muscle_soreness }}'
},
{% endfor %}
];
var wellbeing_data = {
datasets: [
{
label: 'Mindstate',
cubicInterpolationMode: 'monotone',
backgroundColor: gradient_stroke_pink,
borderColor: border_color_pink,
pointBackgroundColor: border_color_pink,
fill: true,
data: mindstate_values,
},
{
label: 'Sleep',
cubicInterpolationMode: 'monotone',
backgroundColor: gradient_stroke_orange,
borderColor: border_color_orange,
pointBackgroundColor: border_color_orange,
fill: true,
data: sleep_values,
},
{
label: 'Stress',
cubicInterpolationMode: 'monotone',
backgroundColor: gradient_stroke_green,
borderColor: border_color_green,
pointBackgroundColor: border_color_green,
fill: true,
data: stress_values,
},
{
label: 'Fatigue',
cubicInterpolationMode: 'monotone',
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,
},
],
};
new Chart(ctx, {
type: 'line',
data: wellbeing_data,
options: {
scales: {
x: {
type: 'time',
display: true,
scaleLabel: {
display: true,
labelString: 'Date',
ticks: {
autoSkip: true,
source: 'data',
},
},
time: {
parser: timeFormat,
tooltipFormat: 'LL',
round: 'day',
},
},
},
plugins: {
legend: {
display: true,
position: 'bottom',
}
}
},
});
{% endif %}
</script>

View File

@ -236,11 +236,11 @@
{% endfor %}
];
var quantity_of_skill_by_passe = [
var mean_quantity_of_skill_by_passe = [
{% for score in intensity_list %}
{
x: '{{ score.date | date:"d-m-Y" }}',
y: '{{ score.quantity_of_skill_by_passe }}'
y: '{{ score.mean_quantity_of_skill_by_passe }}'
},
{% endfor %}
];
@ -275,7 +275,7 @@
cubicInterpolationMode: 'monotone',
borderColor: 'rgb(255, 159, 64)',
pointBackgroundColor: 'rgb(255, 159, 64)',
data: quantity_of_skill_by_passe
data: mean_quantity_of_skill_by_passe
},
{
label: 'diff/skill',

View File

@ -36,21 +36,21 @@ gymnast_urlpatterns = [
views.gymnast_display_events_and_notes,
name="gymnast_display_events_and_notes",
),
path(
r"details/<int:gymnast_id>/injury/",
views.gymnast_display_injury,
name="gymnast_display_injury",
),
# path(
# r"details/<int:gymnast_id>/injury/",
# views.gymnast_display_injury,
# name="gymnast_display_injury",
# ),
path(
r"details/<int:gymnast_id>/scores_chrono/",
views.gymnast_display_scores_chrono,
name="gymnast_display_scores_chrono",
),
path(
r"details/<int:gymnast_id>/wellbeing/",
views.gymnast_display_wellbeing,
name="gymnast_display_wellbeing",
),
# path(
# r"details/<int:gymnast_id>/wellbeing/",
# views.gymnast_display_wellbeing,
# name="gymnast_display_wellbeing",
# ),
path(
r"details/<int:gymnast_id>/physiological/",
views.gymnast_display_physiological,

View File

@ -237,18 +237,25 @@ def gymnast_display_events_and_notes(request, gymnast_id):
return render(request, "gymnasts/tabs/tab_events_and_notes.html", context)
@login_required
@require_http_methods(["GET"])
def gymnast_display_injury(request, gymnast_id):
"""
Renvoie la liste des blessures d'un gymnaste.
# @login_required
# @require_http_methods(["GET"])
# def gymnast_display_injury(request, gymnast_id):
# """
# Renvoie la liste des blessures d'un gymnaste.
Args:
gymnast_id (int) identifiant du gymnast
"""
injuries_list = Injury.objects.filter(gymnast=gymnast_id)
context = {"injuries_list": injuries_list, "gymnast_id": gymnast_id}
return render(request, "gymnasts/list_injury.html", context)
# Args:
# gymnast_id (int) identifiant du gymnast
# """
# start_date = pendulum.now().date().subtract(months=6)
# base_queryset = Injury.objects.filter(gymnast=gymnast_id)
# number_of_injuries = base_queryset.count()
# injuries_list = base_queryset.filter(date__gte=start_date)
# context = {
# "injuries_list": injuries_list,
# "gymnast_id": gymnast_id,
# "number_of_injuries": number_of_injuries,
# }
# return render(request, "gymnasts/list_injury.html", context)
@login_required
@ -260,6 +267,7 @@ def gymnast_display_physiological(request, gymnast_id):
Args:
gymnast_id (int) identifiant du gymnast
"""
number_of_injuries = Injury.objects.filter(gymnast=gymnast_id).count()
start_date = pendulum.now().date().subtract(months=6)
injuries_list = Injury.objects.filter(
gymnast=gymnast_id, date__gte=start_date
@ -273,11 +281,14 @@ def gymnast_display_physiological(request, gymnast_id):
context = {
"injuries_list": injuries_list,
"number_of_injuries": number_of_injuries,
"wellbeing_list": wellbeing_list,
"height_weight_list": height_weight_list,
"gymnast_id": gymnast_id,
}
return render(request, "gymnasts/tabs/tab_physiological.html", context)
return render(
request, "gymnasts/tabs/tab_physiological_and_wellbeing.html", context
)
@login_required
@ -313,22 +324,22 @@ def gymnast_display_scores_chrono(request, gymnast_id):
return render(request, "gymnasts/tabs/tab_scores_and_chronos.html", context)
@login_required
@require_http_methods(["GET"])
def gymnast_display_wellbeing(request, gymnast_id):
"""
Selectionne tous les scores réalisés par le gymnaste.
# @login_required
# @require_http_methods(["GET"])
# def gymnast_display_wellbeing(request, gymnast_id):
# """
# Selectionne tous les scores réalisés par le gymnaste.
Args:
gymnast_id (int) identifiant du gymnast
"""
wellbeing_list = WellBeing.objects.filter(gymnast=gymnast_id).order_by("-date")
# Args:
# gymnast_id (int) identifiant du gymnast
# """
# wellbeing_list = WellBeing.objects.filter(gymnast=gymnast_id).order_by("-date")
context = {
"wellbeing_list": wellbeing_list,
"gymnast_id": gymnast_id,
}
return render(request, "gymnasts/list_wellbeing.html", context)
# context = {
# "wellbeing_list": wellbeing_list,
# "gymnast_id": gymnast_id,
# }
# return render(request, "gymnasts/list_wellbeing.html", context)
@login_required