diff --git a/gym/models.py b/gym/models.py index ac6c2f8..199c8ea 100644 --- a/gym/models.py +++ b/gym/models.py @@ -165,3 +165,12 @@ class Round(models.Model): null=True, ) notes = models.TextField("notes", blank=True) + + @property + def real_percentage(self): + theoretical_max = ( + self.equipment.theoretical_maxs.filter(date__lte=self.session.start) + .order_by("-date") + .first() + ) + return self.chosen_weight / theoretical_max.value * 100 diff --git a/gym/templates/gym/equipment.html b/gym/templates/gym/equipment.html index ecb56f4..2a44764 100644 --- a/gym/templates/gym/equipment.html +++ b/gym/templates/gym/equipment.html @@ -2,7 +2,10 @@ {% load humanize %} {% block title %}{{ equipment.name }} ({{ equipment.room.name }}){% endblock %} -{% block h1 %}{{ equipment.name }} ({{ equipment.room.name }}){% endblock %} +{% block h1 %} + {{ equipment.name }} + ({{ equipment.room.name }}) +{% endblock %} {% block content %} @@ -49,7 +52,8 @@ {% for round in rounds %} {{ round.repetition_number }} répétitions - × {{ round.chosen_weight }} {{ equipment.unit }} + × {{ round.chosen_weight }} {{ equipment.unit }} + ({{ round.theoretical_max_percentage }}% -> {{ round.real_percentage }}%) {% endfor %} {% else %} diff --git a/gym/templates/gym/session_detail.html b/gym/templates/gym/session_detail.html index 223fc45..b0cca92 100644 --- a/gym/templates/gym/session_detail.html +++ b/gym/templates/gym/session_detail.html @@ -51,7 +51,8 @@ {{ round.equipment.name }} – {{ round.repetition_number }} répétitions - × {{ round.chosen_weight }} {{ round.equipment.unit }} + × {{ round.chosen_weight }} {{ round.equipment.unit }} + ({{ round.theoretical_max_percentage }}% -> {{ round.real_percentage }}%) {% endfor %} {% else %}