Compare commits
2 Commits
96ecf9b022
...
fded1c8db2
Author | SHA1 | Date |
---|---|---|
Gregory Trullemans | fded1c8db2 | |
Gregory Trullemans | dcf30a486c |
|
@ -5,7 +5,7 @@
|
|||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4>Latest note</h4>
|
||||
<h4>Latest note ({{ latest_published_note.date | date:'d-m-Y' }})</h4>
|
||||
</div>
|
||||
<div class="card-body pt-0">
|
||||
<p>{{ latest_published_note.to_markdown | safe }}</p>
|
||||
|
@ -22,7 +22,7 @@
|
|||
<div class="card-header">
|
||||
<h4>Next events</h4>
|
||||
</div>
|
||||
<div class="card-body pt-0 pb-0 pr-0 pl-0">
|
||||
<div class="card-body pt-0 pb-0 pr-1 pl-1">
|
||||
{% if next_event_list %}
|
||||
<table class="table tablesorter table-condensed table-striped" id="next_events">
|
||||
<thead>
|
||||
|
@ -43,7 +43,7 @@
|
|||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<p class="pl-3 pb-3 text-muted">No next event associated to this gymnast.</p>
|
||||
<p class="pl-2 pb-3 text-muted">No next event associated to this gymnast.</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -54,7 +54,7 @@
|
|||
<div class="card-header">
|
||||
<h4>Notes</h4>
|
||||
</div>
|
||||
<div class="card-body pt-0 pb-0 pr-0 pl-0">
|
||||
<div class="card-body pt-0 pb-0 pr-1 pl-1">
|
||||
{% if last_notes_list %}
|
||||
<table class="table tablesorter table-condensed table-striped" id="notes">
|
||||
<thead>
|
||||
|
@ -82,7 +82,7 @@
|
|||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<p class="pl-3 text-muted">No note for this gymnast.</p>
|
||||
<p class="pl-2 text-muted">No note for this gymnast.</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="card-footer text-right text-muted pt-0">
|
||||
|
|
|
@ -17,12 +17,13 @@ from reportlab.lib.units import cm
|
|||
from reportlab.pdfgen.canvas import Canvas
|
||||
from reportlab.platypus import Paragraph, Table, TableStyle
|
||||
from ultron.followup.models import (
|
||||
Accident,
|
||||
Chrono,
|
||||
HeightWeight,
|
||||
MindState,
|
||||
Plan,
|
||||
Point
|
||||
Point,
|
||||
Chrono,
|
||||
Accident,
|
||||
MindState,
|
||||
HeightWeight,
|
||||
LearnedSkill,
|
||||
)
|
||||
from ultron.followup.models import LEARNING_STEP_CHOICES
|
||||
from ultron.objective.models import Skill
|
||||
|
@ -190,6 +191,7 @@ class GymnastReportDocument(PDFDocument):
|
|||
self.add_gymnast_active_routine(gymnast)
|
||||
# self.add_gymnast_level_information(gymnast)
|
||||
self.add_gymnast_next_skills(gymnast)
|
||||
self.add_gymnast_last_learned_skill(gymnast)
|
||||
self.add_gymnast_next_events(gymnast)
|
||||
self.add_gymnast_week_notes(gymnast)
|
||||
|
||||
|
@ -522,6 +524,45 @@ class GymnastReportDocument(PDFDocument):
|
|||
"routine defined."
|
||||
)
|
||||
|
||||
def add_gymnast_last_learned_skill(self, gymnast):
|
||||
""" Ajoute les derniers skill appris par le gymnaste
|
||||
|
||||
Args:
|
||||
gymnast <Gymnast> gymnaste
|
||||
|
||||
Returns:
|
||||
Ne retourne rien
|
||||
"""
|
||||
|
||||
self.y = 17*cm
|
||||
self.add_new_line(
|
||||
7*cm,
|
||||
"New learned skills",
|
||||
font_decoration="Bold",
|
||||
)
|
||||
self.add_vspace(-3)
|
||||
|
||||
# le double F ne fonctionne qu'en précisant le distinct, sinon ca dédouble les résultats.
|
||||
# qui lui même ne fonctionne que sur un champ présent dans le `order_by` (que le premier champ ?)
|
||||
#
|
||||
learned_skills = (
|
||||
LearnedSkill.objects.filter(gymnast=gymnast.id)
|
||||
.annotate(skill_notation=F("skill__notation"))
|
||||
.order_by("skill_notation", "-date").distinct('skill_notation')[:5]
|
||||
)
|
||||
|
||||
if learned_skills:
|
||||
for learned_skill in learned_skills:
|
||||
self.add_new_line(
|
||||
7*cm, learned_skill.skill.short_label + " " + str(LEARNING_STEP_CHOICES[learned_skill.learning_step][1]).lower() + " (" + learned_skill.skill.notation + "), " + learned_skill.date.strftime("%d-%m-%Y")
|
||||
)
|
||||
else:
|
||||
self.add_new_line(
|
||||
X,
|
||||
"No skill to learn this week.",
|
||||
)
|
||||
|
||||
|
||||
def add_gymnast_next_skills(self, gymnast):
|
||||
""" Ajoute les prochains skill (skill planifié) à apprendre
|
||||
|
||||
|
|
Loading…
Reference in New Issue