Display real percentage of the round
This commit is contained in:
parent
65d604de15
commit
2c499addfa
3 changed files with 17 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -2,7 +2,10 @@
|
|||
{% load humanize %}
|
||||
|
||||
{% block title %}{{ equipment.name }} ({{ equipment.room.name }}){% endblock %}
|
||||
{% block h1 %}{{ equipment.name }} <small class="text-muted">({{ equipment.room.name }})</small>{% endblock %}
|
||||
{% block h1 %}
|
||||
{{ equipment.name }}
|
||||
<small class="text-muted">({{ equipment.room.name }})</small>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
|
@ -49,7 +52,8 @@
|
|||
{% for round in rounds %}
|
||||
<a href="{% url 'round-edit' round.pk %}"
|
||||
class="list-group-item list-group-item-action">{{ round.repetition_number }} répétitions
|
||||
× {{ round.chosen_weight }} {{ equipment.unit }}</a>
|
||||
× {{ round.chosen_weight }} {{ equipment.unit }}
|
||||
({{ round.theoretical_max_percentage }}% -> {{ round.real_percentage }}%)</a>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
|
|
|
@ -51,7 +51,8 @@
|
|||
<a href="{% url 'round-edit' round.pk %}"
|
||||
class="list-group-item list-group-item-action">{{ round.equipment.name }}
|
||||
– {{ round.repetition_number }} répétitions
|
||||
× {{ round.chosen_weight }} {{ round.equipment.unit }}</a>
|
||||
× {{ round.chosen_weight }} {{ round.equipment.unit }}
|
||||
({{ round.theoretical_max_percentage }}% -> {{ round.real_percentage }}%)</a>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
|
|
Loading…
Reference in a new issue