Compare commits

..

No commits in common. "2e22b04643ba1da3f56aa1ac06f3ab8a161bf9f4" and "fbe02f39c5f6a2abff7acd3939ae74c37eac15d1" have entirely different histories.

4 changed files with 29 additions and 115 deletions

View File

@ -941,10 +941,10 @@ def injury_create_or_update(request, injury_id=None, gymnast_id=None):
html_message=f"""<p>Bonjour,</p> html_message=f"""<p>Bonjour,</p>
<p>Un nouvelle blessure enregistrée pour {gymnast} pour le {date.strftime('%d %B %Y')}:</p> <p>Un nouvelle blessure enregistrée pour {gymnast} pour le {date.strftime('%d %B %Y')}:</p>
<ul> <ul>
<li>{INJURY_MECHANISM_CHOICE[mechanism][1]},</li>
<li>{INJURY_TYPE_CHOICE[injury_type][1]},</li> <li>{INJURY_TYPE_CHOICE[injury_type][1]},</li>
<li>caused by {INJURY_MECHANISM_CHOICE[mechanism][1]},</li> <li>{INJURY_LOCATION_CHOICE[location][1]},</li>
<li>on {INJURY_LOCATION_CHOICE[location][1]},</li> <li>{INJURY_BODY_SIDE_CHOICE[body_side][1]},</li>
<li>{INJURY_BODY_SIDE_CHOICE[body_side][1]} side,</li>
</ul> </ul>
{MAIL_FOOTER}""", {MAIL_FOOTER}""",
) )
@ -1033,7 +1033,6 @@ def wellbeing_create_or_update(
stress = form.cleaned_data["stress"] stress = form.cleaned_data["stress"]
fatigue = form.cleaned_data["fatigue"] fatigue = form.cleaned_data["fatigue"]
muscle_soreness = form.cleaned_data["muscle_soreness"] muscle_soreness = form.cleaned_data["muscle_soreness"]
details = form.cleaned_data["informations"]
functionality = ContentType.objects.get(model="wellbeing") functionality = ContentType.objects.get(model="wellbeing")
for notification in gymnast.notifications.filter( for notification in gymnast.notifications.filter(
functionality=functionality functionality=functionality
@ -1055,7 +1054,6 @@ def wellbeing_create_or_update(
<li>Fatigue: {fatigue}</li> <li>Fatigue: {fatigue}</li>
<li>Muscle soreness: {muscle_soreness}</li> <li>Muscle soreness: {muscle_soreness}</li>
</ul> </ul>
{details}
{MAIL_FOOTER} {MAIL_FOOTER}
""", """,
) )
@ -1157,7 +1155,7 @@ def heightweight_create_or_update(request, heightweight_id=None, gymnast_id=None
receiver, receiver,
fail_silently=False, fail_silently=False,
html_message=f"""<p>Bonjour,</p> html_message=f"""<p>Bonjour,</p>
<p>Un nouveau poids/taille enregistré pour {gymnast} pour le {date.strftime('%d %B %Y')}:</p> <p>Un nouveau poids/taille enregistré pour {gymnast} pour le {date.strftime('%d %B %Y')} :</p>
<ul> <ul>
<li>Height: {height} cm</li> <li>Height: {height} cm</li>
<li>Weight: {weight} kg</li> <li>Weight: {weight} kg</li>
@ -1476,8 +1474,8 @@ def intensity_create_or_update(request, intensity_id=None, gymnast_id=None):
number_of_passes = form.cleaned_data["number_of_passes"] number_of_passes = form.cleaned_data["number_of_passes"]
skill_by_time = quantity_of_skill / time skill_by_time = quantity_of_skill / time
skill_by_passe = quantity_of_skill / number_of_passes skill_by_passe = quantity_of_skill / number_of_passes
diff_by_skill = difficulty / (10 * quantity_of_skill) diff_by_skill = difficulty / quantity_of_skill
diff_by_passe = difficulty / (10 * number_of_passes) diff_by_passe = difficulty / number_of_passes
time_by_passe = time / number_of_passes time_by_passe = time / number_of_passes
gymnast = Gymnast.objects.get(pk=form.cleaned_data["gymnast"].id) gymnast = Gymnast.objects.get(pk=form.cleaned_data["gymnast"].id)
functionality = ContentType.objects.get(model="intensity") functionality = ContentType.objects.get(model="intensity")
@ -1493,7 +1491,7 @@ def intensity_create_or_update(request, intensity_id=None, gymnast_id=None):
receiver, receiver,
fail_silently=False, fail_silently=False,
html_message=f"""<p>Bonjour,</p> html_message=f"""<p>Bonjour,</p>
<p>{gymnast} a encodé une nouvelle intensité pour le {date.strftime('%d %B %Y')}:</p> <p>{gymnast} a encodé une nouvelle intensité (pour le {date.strftime('%d %B %Y')}) :</p>
<ul> <ul>
<li>{number_of_passes} passages</li> <li>{number_of_passes} passages</li>
<li>{time} minutes</li> <li>{time} minutes</li>
@ -1502,8 +1500,8 @@ def intensity_create_or_update(request, intensity_id=None, gymnast_id=None):
</ul> </ul>
<p><u>Statistics:</u></p> <p><u>Statistics:</u></p>
<ul> <ul>
<li>Passe: {time_by_passe:.2f}min</li> <li>Time/passe: {time_by_passe:.2f}</li>
<li>Skill: {skill_by_time:.2f}min</li> <li>Skill/time: {skill_by_time:.2f}</li>
<li>Skill/passe: {skill_by_passe:.2f}</li> <li>Skill/passe: {skill_by_passe:.2f}</li>
<li>Diff/passe: {diff_by_passe:.2f}</li> <li>Diff/passe: {diff_by_passe:.2f}</li>
<li>Diff/skill: {diff_by_skill:.2f}</li> <li>Diff/skill: {diff_by_skill:.2f}</li>

View File

@ -57,7 +57,6 @@
{% endif %} {% endif %}
</div> </div>
</div> </div>
<br />
<div class="row"> <div class="row">
<div class="col-4"> <div class="col-4">
<h4 class="mb-1">Physiological</h4> <h4 class="mb-1">Physiological</h4>
@ -73,31 +72,31 @@
<tr> <tr>
<td class="pt-0 pb-0"><b>Mind state</b></td> <td class="pt-0 pb-0"><b>Mind state</b></td>
<td class="pt-0 pb-0 text-right">{{ wellbeing_score.min_mindstate_value }}</td> <td class="pt-0 pb-0 text-right">{{ wellbeing_score.min_mindstate_value }}</td>
<td class="pt-0 pb-0 text-right"><b>{{ wellbeing_score.mean_mindstate_value|stringformat:".1f" }}</b></td> <td class="pt-0 pb-0 text-right">{{ wellbeing_score.mean_mindstate_value|stringformat:".1f" }}</td>
<td class="pt-0 pb-0 text-right">{{ wellbeing_score.max_mindstate_value }}</td> <td class="pt-0 pb-0 text-right">{{ wellbeing_score.max_mindstate_value }}</td>
</tr> </tr>
<tr> <tr>
<td class="pt-0 pb-0"><b>Sleep</b></td> <td class="pt-0 pb-0"><b>Sleep</b></td>
<td class="pt-0 pb-0 text-right">{{ wellbeing_score.min_sleep_value }}</td> <td class="pt-0 pb-0 text-right">{{ wellbeing_score.min_sleep_value }}</td>
<td class="pt-0 pb-0 text-right"><b>{{ wellbeing_score.mean_sleep_value|stringformat:".1f" }}</b></td> <td class="pt-0 pb-0 text-right">{{ wellbeing_score.mean_sleep_value|stringformat:".1f" }}</td>
<td class="pt-0 pb-0 text-right">{{ wellbeing_score.max_sleep_value }}</td> <td class="pt-0 pb-0 text-right">{{ wellbeing_score.max_sleep_value }}</td>
</tr> </tr>
<tr> <tr>
<td class="pt-0 pb-0"><b>Stress</b></td> <td class="pt-0 pb-0"><b>Stress</b></td>
<td class="pt-0 pb-0 text-right">{{ wellbeing_score.min_stress_value }}</td> <td class="pt-0 pb-0 text-right">{{ wellbeing_score.min_stress_value }}</td>
<td class="pt-0 pb-0 text-right"><b>{{ wellbeing_score.mean_stress_value|stringformat:".1f" }}</b></td> <td class="pt-0 pb-0 text-right">{{ wellbeing_score.mean_stress_value|stringformat:".1f" }}</td>
<td class="pt-0 pb-0 text-right">{{ wellbeing_score.max_stress_value }}</td> <td class="pt-0 pb-0 text-right">{{ wellbeing_score.max_stress_value }}</td>
</tr> </tr>
<tr> <tr>
<td class="pt-0 pb-0"><b>Fatigue</b></td> <td class="pt-0 pb-0"><b>Fatigue</b></td>
<td class="pt-0 pb-0 text-right">{{ wellbeing_score.min_fatigue_value }}</td> <td class="pt-0 pb-0 text-right">{{ wellbeing_score.min_fatigue_value }}</td>
<td class="pt-0 pb-0 text-right"><b>{{ wellbeing_score.mean_fatigue_value|stringformat:".1f" }}</b></td> <td class="pt-0 pb-0 text-right">{{ wellbeing_score.mean_fatigue_value|stringformat:".1f" }}</td>
<td class="pt-0 pb-0 text-right">{{ wellbeing_score.max_fatigue_value }}</td> <td class="pt-0 pb-0 text-right">{{ wellbeing_score.max_fatigue_value }}</td>
</tr> </tr>
<tr> <tr>
<td class="pt-0 pb-0"><b>Muscle soreness</b></td> <td class="pt-0 pb-0"><b>Muscle soreness</b></td>
<td class="pt-0 pb-0 text-right">{{ wellbeing_score.min_muscle_soreness_value }}</td> <td class="pt-0 pb-0 text-right">{{ wellbeing_score.min_muscle_soreness_value }}</td>
<td class="pt-0 pb-0 text-right"><b>{{ wellbeing_score.mean_muscle_soreness_value|stringformat:".1f" }}</b></td> <td class="pt-0 pb-0 text-right">{{ wellbeing_score.mean_muscle_soreness_value|stringformat:".1f" }}</td>
<td class="pt-0 pb-0 text-right">{{ wellbeing_score.max_muscle_soreness_value }}</td> <td class="pt-0 pb-0 text-right">{{ wellbeing_score.max_muscle_soreness_value }}</td>
</tr> </tr>
{% endif %} {% endif %}
@ -105,7 +104,7 @@
<tr> <tr>
<td class="pt-0 pb-0"><b>Height</b></td> <td class="pt-0 pb-0"><b>Height</b></td>
<td class="pt-0 pb-0 text-right">{{ height_weight_value.min_height_value }}</td> <td class="pt-0 pb-0 text-right">{{ height_weight_value.min_height_value }}</td>
<td class="pt-0 pb-0 text-right"><b>{{ height_weight_value.mean_height_value|stringformat:".1f" }}</b></td> <td class="pt-0 pb-0 text-right">{{ height_weight_value.mean_height_value|stringformat:".1f" }}</td>
<td class="pt-0 pb-0 text-right">{{ height_weight_value.max_height_value }}</td> <td class="pt-0 pb-0 text-right">{{ height_weight_value.max_height_value }}</td>
</tr> </tr>
{% endif %} {% endif %}
@ -113,13 +112,13 @@
<tr> <tr>
<td class="pt-0 pb-0"><b>Weight</b></td> <td class="pt-0 pb-0"><b>Weight</b></td>
<td class="pt-0 pb-0 text-right">{{ height_weight_value.min_weight_value }}</td> <td class="pt-0 pb-0 text-right">{{ height_weight_value.min_weight_value }}</td>
<td class="pt-0 pb-0 text-right"><b>{{ height_weight_value.mean_weight_value|stringformat:".1f" }}</b></td> <td class="pt-0 pb-0 text-right">{{ height_weight_value.mean_weight_value|stringformat:".1f" }}</td>
<td class="pt-0 pb-0 text-right">{{ height_weight_value.max_weight_value }}</td> <td class="pt-0 pb-0 text-right">{{ height_weight_value.max_weight_value }}</td>
</tr> </tr>
{% endif %} {% endif %}
</table> </table>
{% else %} {% else %}
No information encoded for selected week. No information for selected week.
{% endif %} {% endif %}
</div> </div>
<div class="col-4"> <div class="col-4">
@ -136,76 +135,31 @@
<tr> <tr>
<td class="pt-0 pb-0"><b>Time</b></td> <td class="pt-0 pb-0"><b>Time</b></td>
<td class="pt-0 pb-0 text-right">{{ intensity_value.min_intensity_time_value }}</td> <td class="pt-0 pb-0 text-right">{{ intensity_value.min_intensity_time_value }}</td>
<td class="pt-0 pb-0 text-right"><b>{{ intensity_value.mean_intensity_time_value|stringformat:".0f" }}</b></td> <td class="pt-0 pb-0 text-right">{{ intensity_value.mean_intensity_time_value|stringformat:".0f" }}</td>
<td class="pt-0 pb-0 text-right">{{ intensity_value.max_intensity_time_value }}</td> <td class="pt-0 pb-0 text-right">{{ intensity_value.max_intensity_time_value }}</td>
</tr> </tr>
<tr> <tr>
<td class="pt-0 pb-0"><b>Diff.</b></td> <td class="pt-0 pb-0"><b>Diff.</b></td>
<td class="pt-0 pb-0 text-right">{{ intensity_value.min_intensity_difficulty_value }}</td> <td class="pt-0 pb-0 text-right">{{ intensity_value.min_intensity_difficulty_value }}</td>
<td class="pt-0 pb-0 text-right"><b>{{ intensity_value.mean_intensity_difficulty_value|stringformat:".0f" }}</b></td> <td class="pt-0 pb-0 text-right">{{ intensity_value.mean_intensity_difficulty_value|stringformat:".0f" }}</td>
<td class="pt-0 pb-0 text-right">{{ intensity_value.max_intensity_difficulty_value }}</td> <td class="pt-0 pb-0 text-right">{{ intensity_value.max_intensity_difficulty_value }}</td>
</tr> </tr>
<tr> <tr>
<td class="pt-0 pb-0"><b># Skill</b></td> <td class="pt-0 pb-0"><b># Skill</b></td>
<td class="pt-0 pb-0 text-right">{{ intensity_value.min_quantity_of_skill_value }}</td> <td class="pt-0 pb-0 text-right">{{ intensity_value.min_quantity_of_skill_value }}</td>
<td class="pt-0 pb-0 text-right"><b>{{ intensity_value.mean_quantity_of_skill_value|stringformat:".0f" }}</b></td> <td class="pt-0 pb-0 text-right">{{ intensity_value.mean_quantity_of_skill_value|stringformat:".0f" }}</td>
<td class="pt-0 pb-0 text-right">{{ intensity_value.max_quantity_of_skill_value }}</td> <td class="pt-0 pb-0 text-right">{{ intensity_value.max_quantity_of_skill_value }}</td>
</tr> </tr>
<tr> <tr>
<td class="pt-0 pb-0"><b># Passes</b></td> <td class="pt-0 pb-0"><b># Passes</b></td>
<td class="pt-0 pb-0 text-right">{{ intensity_value.min_number_of_passes_value }}</td> <td class="pt-0 pb-0 text-right">{{ intensity_value.min_number_of_passes_value }}</td>
<td class="pt-0 pb-0 text-right"><b>{{ intensity_value.mean_number_of_passes_value|stringformat:".0f" }}</b></td> <td class="pt-0 pb-0 text-right">{{ intensity_value.mean_number_of_passes_value|stringformat:".0f" }}</td>
<td class="pt-0 pb-0 text-right">{{ intensity_value.max_number_of_passes_value }}</td> <td class="pt-0 pb-0 text-right">{{ intensity_value.max_number_of_passes_value }}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
{% else %} {% else %}
No intensty encoded for the selected period. No intensty for selected period.
{% endif %}
</div>
<div class="col-12">
<h4 class="mb-1">Injury</h4>
{% if injuries_list %}
<table class="table" id="injury_table">
<thead class="text-primary">
<tr>
<th class="header text-left" style="width: 7%">Date</th>
<th class="header text-left" style="width: 20%">Gymnast</th>
<th class="header text-left" style="width: 10%">Mechanism</th>
<th class="header text-left" style="width: 20%">Location</th>
<th class="header text-left" style="width: 10%">Side</th>
<th style="width: 20%">Skill</th>
<th style="width: 8%"># Week off</th>
</tr>
</thead>
<tbody>
{% for injury in injuries_list %}
<tr role="row" class="{% cycle 'odd' 'even' %}">
<td class="text-left">{{ injury.date | date:"d-m-Y" }}</td>
<td class="text-left">{{ injury.gymnast }}</td>
<td class="text-left">{{ injury.get_mechanism_display }}</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 %}
{{ injury.skill }}
{% else %}
-
{% endif %}
</td>
<td class="text-right">
{% if injury.nb_week_off %}
{{ injury.nb_week_off }}
{% else %}
-
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p class="muted-text">There are no injury encoded for the selected period.</p>
{% endif %} {% endif %}
</div> </div>
</div> </div>
@ -278,7 +232,7 @@
{% endif %} {% endif %}
</table> </table>
{% else %} {% else %}
No chrono/ToF encoded for the selected period. No chrono/ToF found.
{% endif %} {% endif %}
</div> </div>
@ -352,7 +306,7 @@
{% endif %} {% endif %}
</table> </table>
{% else %} {% else %}
No scores encoded for the selected period. No scores during the selected week.
{% endif %} {% endif %}
</div> </div>
</div> </div>
@ -372,7 +326,7 @@
{% endfor %} {% endfor %}
</table> </table>
{% else %} {% else %}
No new skill learned on the selected period. No new skill learned on the selected week.
{% endif %} {% endif %}
</div> </div>
<div class="col-6"> <div class="col-6">
@ -389,7 +343,7 @@
{% endfor %} {% endfor %}
</table> </table>
{% else %} {% else %}
No objective reached for the selected period. No objective for the selected week.
{% endif %} {% endif %}
</div> </div>
</div> </div>
@ -408,7 +362,7 @@
{% endfor %} {% endfor %}
</table> </table>
{% else %} {% else %}
No events encoded on the selected period. No events on the selected week.
{% endif %} {% endif %}
</div> </div>
</div> </div>
@ -421,7 +375,7 @@
{{ note.to_markdown | safe }} {{ note.to_markdown | safe }}
{% endfor %} {% endfor %}
{% else %} {% else %}
No note encoded for the selected period. No note for the selected week.
{% endif %} {% endif %}
</div> </div>
</div> </div>

View File

@ -106,11 +106,6 @@ gymnast_urlpatterns = [
views.gymnast_report_evaluation, views.gymnast_report_evaluation,
name="gymnast_report_evaluation", name="gymnast_report_evaluation",
), ),
# path(
# r"resume/<int:gymnast_id>/season/<str:season>/week_number/<int:week_number>/",
# views.generate_week_resume,
# name="generate_week_resume",
# ),
path(r"add/", views.gymnast_create_or_update, name="gymnast_create"), path(r"add/", views.gymnast_create_or_update, name="gymnast_create"),
path( path(
r"edit/<int:gymnast_id>/", views.gymnast_create_or_update, name="gymnast_update" r"edit/<int:gymnast_id>/", views.gymnast_create_or_update, name="gymnast_update"

View File

@ -1003,10 +1003,6 @@ def generate_report_for_period(
max_number_of_passes_value=Max("number_of_passes"), max_number_of_passes_value=Max("number_of_passes"),
) )
injury_list = gymnast.injuries.filter(
date__gte=date_begin, date__lte=date_end
).order_by("date")
# BEST TOF # BEST TOF
number_of_tof_straightjump = Chrono.objects.filter( number_of_tof_straightjump = Chrono.objects.filter(
gymnast=gymnast, date__gte=date_begin, date__lte=date_end, chrono_type=0 gymnast=gymnast, date__gte=date_begin, date__lte=date_end, chrono_type=0
@ -1240,7 +1236,6 @@ def generate_report_for_period(
# MEDICAL INFORMATIONS # MEDICAL INFORMATIONS
"wellbeing_score": wellbeing_score, "wellbeing_score": wellbeing_score,
"height_weight_value": height_weight_value, "height_weight_value": height_weight_value,
"injury_list": injury_list,
# INTENSITY # INTENSITY
"intensity_value": intensity_value, "intensity_value": intensity_value,
# TOF # TOF
@ -1380,7 +1375,7 @@ def generate_timeline_report(
- nouveau apprentissage (learned skill) - nouveau apprentissage (learned skill)
- blessures - blessures
- GymnastHasRoutine - GymnastHasRoutine
et on les trie par date. eton les trie par date.
Args: Args:
gymnast_id (int) identifiant du gymnast gymnast_id (int) identifiant du gymnast
@ -1498,31 +1493,3 @@ def generate_timeline_report(
], ],
) # , font_config=font_config) ) # , font_config=font_config)
return response return response
# @login_required
# @require_http_methods(["GET"])
# def generate_week_resume(request, gymnast_id, season=None, week_number=None):
# """va rechercher les informations nécessaires pour aider à la note de la semaine
# - wellbeing
# - intensity
# - injury
# Args:
# gymnast_id (int) identifiant du gymnast
# season (int) saison
# week_number (int) numéro de semaine
# date (date) date
# """
# gymnast = get_object_or_404(Gymnast, pk=gymnast_id)
# if season is None:
# date_begin = pendulum.now().date()
# season, week_number = from_date_to_week_number(date_begin)
# else:
# date_begin, _ = from_week_number_to_date(season, week_number)
# date_begin = date_begin.date()
# wellbeing_list = gymnast.wellbeing.objects.filter(season="season", week_number="week_number")
# intensity_list = gymnast.intensities.objects.filter(season="season", week_number="week_number")
# injury_list = gymnast.injuries.filter(season="season", week_number="week_number")