update mail notification
This commit is contained in:
parent
e873ebeaa0
commit
ef55eaf65c
|
@ -14,6 +14,14 @@ from jarvis.people.models import Gymnast
|
||||||
from jarvis.planning.models import Event
|
from jarvis.planning.models import Event
|
||||||
from jarvis.objective.models import Skill
|
from jarvis.objective.models import Skill
|
||||||
|
|
||||||
|
from .models import (
|
||||||
|
CHRONO_TYPE_CHOICE,
|
||||||
|
SCORE_TYPE_CHOICE,
|
||||||
|
INJURY_MECHANISM_CHOICE,
|
||||||
|
INJURY_BODY_SIDE_CHOICE,
|
||||||
|
INJURY_TYPE_CHOICE,
|
||||||
|
INJURY_LOCATION_CHOICE,
|
||||||
|
)
|
||||||
from .models import (
|
from .models import (
|
||||||
Plan,
|
Plan,
|
||||||
Note,
|
Note,
|
||||||
|
@ -592,7 +600,7 @@ def chrono_create_or_update(request, chrono_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>Nouveau chrono pour {gymnast} : {chrono_type} - {score} ({score_type}).</p><br />
|
<p>Nouveau chrono pour {gymnast} : {CHRONO_TYPE_CHOICE[chrono_type]} - {score} ({SCORE_TYPE_CHOICE[score_type]}).</p><br />
|
||||||
<p>Excellente journée</p><p>Jarvis</p>""",
|
<p>Excellente journée</p><p>Jarvis</p>""",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -862,6 +870,11 @@ def injury_create_or_update(request, injury_id=None, gymnast_id=None):
|
||||||
# notification
|
# notification
|
||||||
receiver = []
|
receiver = []
|
||||||
gymnast = Gymnast.objects.get(pk=form.cleaned_data["gymnast"].id)
|
gymnast = Gymnast.objects.get(pk=form.cleaned_data["gymnast"].id)
|
||||||
|
location = form.cleaned_data["location"]
|
||||||
|
injury_type = form.cleaned_data["injury_type"]
|
||||||
|
body_side = form.cleaned_data["body_side"]
|
||||||
|
mechanism = form.cleaned_data["mechanism"]
|
||||||
|
date = form.cleaned_data["date"]
|
||||||
functionality = ContentType.objects.get(model="injury")
|
functionality = ContentType.objects.get(model="injury")
|
||||||
for notification in gymnast.notifications.filter(
|
for notification in gymnast.notifications.filter(
|
||||||
functionality=functionality
|
functionality=functionality
|
||||||
|
@ -875,8 +888,16 @@ def injury_create_or_update(request, injury_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 nouvelle blessure enregistrée pour {gymnast}.</p><br />
|
<p>Un nouvelle blessure enregistrée pour {gymnast} pour le {date.strftime('%d %B %Y')}:</p>
|
||||||
<p>Excellente journée</p><p>Jarvis</p>""",
|
<ul>
|
||||||
|
<li>{INJURY_LOCATION_CHOICE[mechanism]},</li>
|
||||||
|
<li>{INJURY_BODY_SIDE_CHOICE[injury_type]},</li>
|
||||||
|
<li>{INJURY_MECHANISM_CHOICE[location]},</li>
|
||||||
|
<li>{INJURY_TYPE_CHOICE[body_side]},</li>
|
||||||
|
</ul>
|
||||||
|
<br />
|
||||||
|
<p>Excellente journée</p>
|
||||||
|
<p>Jarvis</p>""",
|
||||||
)
|
)
|
||||||
|
|
||||||
return HttpResponseRedirect(reverse("injury_details", args=(injury.pk,)))
|
return HttpResponseRedirect(reverse("injury_details", args=(injury.pk,)))
|
||||||
|
@ -982,7 +1003,7 @@ def wellbeing_create_or_update(
|
||||||
<li>Sleep: {sleep}</li>
|
<li>Sleep: {sleep}</li>
|
||||||
<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>
|
</ul>
|
||||||
<br />
|
<br />
|
||||||
<p>Excellente journée</p><p>Jarvis</p>""",
|
<p>Excellente journée</p><p>Jarvis</p>""",
|
||||||
|
@ -1407,6 +1428,7 @@ def intensity_create_or_update(request, intensity_id=None, gymnast_id=None):
|
||||||
difficulty = form.cleaned_data["difficulty"]
|
difficulty = form.cleaned_data["difficulty"]
|
||||||
quantity_of_skill = form.cleaned_data["quantity_of_skill"]
|
quantity_of_skill = form.cleaned_data["quantity_of_skill"]
|
||||||
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_passe = quantity_of_skill / number_of_passes
|
skill_by_passe = quantity_of_skill / number_of_passes
|
||||||
diff_by_skill = difficulty / quantity_of_skill
|
diff_by_skill = difficulty / quantity_of_skill
|
||||||
diff_by_passe = difficulty / number_of_passes
|
diff_by_passe = difficulty / number_of_passes
|
||||||
|
@ -1430,14 +1452,15 @@ def intensity_create_or_update(request, intensity_id=None, gymnast_id=None):
|
||||||
<li>{number_of_passes} passages</li>
|
<li>{number_of_passes} passages</li>
|
||||||
<li>{time} minutes</li>
|
<li>{time} minutes</li>
|
||||||
<li>{quantity_of_skill} figures</li>
|
<li>{quantity_of_skill} figures</li>
|
||||||
<li>{difficulty} diff.</li>
|
<li>{difficulty / 10} diff.</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p><u>Statistiques :</u></p>
|
<p><u>Statistics :</u></p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Average passe time : {time_by_passe}</li>
|
<li>Time/passe: {time_by_passe:.2f}</li>
|
||||||
<li>Skill by passe : {skill_by_passe}</li>
|
<li>Skill/time: {skill_by_time:.2f}</li>
|
||||||
<li>Diff by passe : {diff_by_passe}</li>
|
<li>Skill/passe: {skill_by_passe:.2f}</li>
|
||||||
<li>Diff by skill : {diff_by_skill}</li>
|
<li>Diff/passe: {diff_by_passe:.2f}</li>
|
||||||
|
<li>Diff/skill: {diff_by_skill:.2f}</li>
|
||||||
</ul>
|
</ul>
|
||||||
<br />
|
<br />
|
||||||
<p>Excellente journée</p>
|
<p>Excellente journée</p>
|
||||||
|
|
Loading…
Reference in New Issue