Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Show the repetition unit in the calendar log

Roland Geider022f8661a507
diff --git a/wger/core/models.py b/wger/core/models.py
index 7872aabb8..d73ac7446 100644
--- a/wger/core/models.py
+++ b/wger/core/models.py
@@ -597,6 +597,15 @@ class RepetitionUnit(models.Model):
'''
return None
+ @property
+ def is_repetition(self):
+ '''
+ Checks that the repetition unit is a repetition proper
+
+ This is done basically to not litter the code with magic IDs
+ '''
+ return self.id == 1
+
@python_2_unicode_compatible
class WeightUnit(models.Model):
@@ -626,3 +635,12 @@ class WeightUnit(models.Model):
Unit has no owner information
'''
return None
+
+ @property
+ def is_weight(self):
+ '''
+ Checks that the unit is a weight proper
+
+ This is done basically to not litter the code with magic IDs
+ '''
+ return self.id in (1, 2)
diff --git a/wger/manager/templates/calendar/day.html b/wger/manager/templates/calendar/day.html
index cefa9d569..ec8637fe4 100644
--- a/wger/manager/templates/calendar/day.html
+++ b/wger/manager/templates/calendar/day.html
@@ -49,7 +49,12 @@
{% for log in logs %}
<tr>
<td>
- {{log.reps}} × {{log.weight}} {% trans_weight_unit 'kg' owner_user %}
+ {{log.reps}}
+ {% if not log.repetition_unit.is_repetition %}
+ {% trans log.repetition_unit.name %}
+ {% endif %}
+ ×
+ {{log.weight}} {% trans log.weight_unit.name %}
{% if is_owner %}
<span class="editoptions">
diff --git a/wger/manager/templates/calendar/month.html b/wger/manager/templates/calendar/month.html
index 99ec3c669..4a23d6064 100644
--- a/wger/manager/templates/calendar/month.html
+++ b/wger/manager/templates/calendar/month.html
@@ -62,7 +62,13 @@ $(document).ready(function() {
<ul class="list-group" style="min-height: 10em;">
{% for log in logs %}
<li class="list-group-item">
- {{log.reps}} × {{log.weight}}
+ {{log.reps}}
+ {% if not log.repetition_unit.is_repetition %}
+ {% trans log.repetition_unit.name %}
+ {% endif %}
+ ×
+ {{log.weight}} {% trans log.weight_unit.name %}
+
{% if is_owner %}
<span class="editoptions">
<div class="btn-group pull-right">