Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Consistently use "repetitions" instead of "reps"

Roland Geider54a919c3f2ca
diff --git a/wger/manager/api/serializers.py b/wger/manager/api/serializers.py
index d36a628cf..75d9c88d3 100644
--- a/wger/manager/api/serializers.py
+++ b/wger/manager/api/serializers.py
@@ -201,7 +201,7 @@ class SlotEntryStructureSerializer(serializers.ModelSerializer):
max_weight_configs = WeightConfigSerializer(source='maxweightconfig_set', many=True)
repetitions_configs = RepetitionsConfigSerializer(source='repetitionsconfig_set', many=True)
max_repetitions_configs = RepetitionsConfigSerializer(
- source='maxrepetitionssconfig_set',
+ source='maxrepetitionsconfig_set',
many=True
)
set_nr_configs = SetNrConfigSerializer(source='setsconfig_set', many=True)
@@ -353,10 +353,10 @@ class SetConfigDataSerializer(serializers.Serializer):
max_weight = serializers.DecimalField(max_digits=5, decimal_places=2)
weight_unit = serializers.IntegerField()
weight_rounding = serializers.DecimalField(max_digits=4, decimal_places=2)
- reps = serializers.DecimalField(max_digits=5, decimal_places=2)
- max_reps = serializers.DecimalField(max_digits=5, decimal_places=2)
- reps_unit = serializers.IntegerField()
- reps_rounding = serializers.DecimalField(max_digits=4, decimal_places=2)
+ repetitions = serializers.DecimalField(max_digits=5, decimal_places=2)
+ max_repetitions = serializers.DecimalField(max_digits=5, decimal_places=2)
+ repetitions_unit = serializers.IntegerField()
+ repetitions_rounding = serializers.DecimalField(max_digits=4, decimal_places=2)
rir = serializers.DecimalField(max_digits=5, decimal_places=2)
max_rir = serializers.DecimalField(max_digits=5, decimal_places=2)
rpe = serializers.DecimalField(max_digits=5, decimal_places=2)
diff --git a/wger/manager/config_calculations/dummy.py b/wger/manager/config_calculations/dummy.py
index 4e38e8d36..6fdd3ed75 100644
--- a/wger/manager/config_calculations/dummy.py
+++ b/wger/manager/config_calculations/dummy.py
@@ -26,7 +26,7 @@ class SetCalculations(AbstractSetCalculations):
exercise=1,
sets=2,
weight=24,
- reps=1,
+ repetitions=1,
rir=2,
rest=120,
)
@@ -35,7 +35,7 @@ class SetCalculations(AbstractSetCalculations):
exercise=2,
sets=4,
weight=42,
- reps=10,
+ repetitions=10,
rir=1,
rest=90,
)
diff --git a/wger/manager/consts.py b/wger/manager/consts.py
index e7d5c7f31..00e66538e 100644
--- a/wger/manager/consts.py
+++ b/wger/manager/consts.py
@@ -27,6 +27,6 @@ RIR_OPTIONS = [
('4', 4),
]
-ID_UNIT_REPS = 1
+ID_UNIT_REPETITIONS = 1
ID_UNIT_KG = 1
ID_UNIT_LB = 2
diff --git a/wger/manager/dataclasses.py b/wger/manager/dataclasses.py
index 3746ceb6e..d666b0806 100644
--- a/wger/manager/dataclasses.py
+++ b/wger/manager/dataclasses.py
@@ -46,21 +46,21 @@ class SetConfigData:
exercise: int
weight: Decimal | int | None
- reps: Decimal | int | None
+ repetitions: Decimal | int | None
rir: Decimal | int | None
rest: int | None
max_rir: Decimal | int | None = None
max_weight: Decimal | int | None = None
- max_reps: Decimal | int | None = None
+ max_repetitions: Decimal | int | None = None
max_rest: int | None = None
max_sets: int | None = None
sets: int = 1
weight_unit: int | None = 1
- reps_unit: int | None = 1
+ repetitions_unit: int | None = 1
weight_rounding: Decimal | int | None = None
- reps_rounding: Decimal | int | None = None
+ repetitions_rounding: Decimal | int | None = None
comment: str = ''
type: str = 'normal'
@@ -96,23 +96,24 @@ class SetConfigData:
out.append(f'{sets} {_("Sets")},')
- if self.reps:
- reps = round_value(self.reps, self.reps_rounding)
+ if self.repetitions:
+ reps = round_value(self.repetitions, self.repetitions_rounding)
max_reps = (
- round_value(self.max_reps, self.reps_rounding) if self.max_reps else self.max_reps
+ round_value(self.max_repetitions,
+ self.repetitions_rounding) if self.max_repetitions else self.max_repetitions
)
if max_reps:
reps = f'{reps}-{max_reps}'
unit = ''
- if self.reps_unit in (1, 2) and not self.weight:
+ if self.repetitions_unit in (1, 2) and not self.weight:
unit = _('Reps')
- elif self.reps_unit == 2:
+ elif self.repetitions_unit == 2:
unit = '∞'
reps = ''
- elif self.reps_unit not in (1, 2):
- unit = _(RepetitionUnit.objects.get(pk=self.reps_unit).name)
+ elif self.repetitions_unit not in (1, 2):
+ unit = _(RepetitionUnit.objects.get(pk=self.repetitions_unit).name)
out.append(f'{reps} {unit}'.strip())
diff --git a/wger/manager/management/commands/dummy-generator-workout-diary.py b/wger/manager/management/commands/dummy-generator-workout-diary.py
index 68bd5df07..437166ef2 100644
--- a/wger/manager/management/commands/dummy-generator-workout-diary.py
+++ b/wger/manager/management/commands/dummy-generator-workout-diary.py
@@ -68,8 +68,8 @@ class Command(BaseCommand):
for exercise_id in slot_data.exercises:
for set_data in slot_data.sets:
reps = (
- set_data.reps + random.randint(-1, 2)
- if set_data.reps
+ set_data.repetitions + random.randint(-1, 2)
+ if set_data.repetitions
else random.randint(3, 12)
)
weight = (
@@ -124,8 +124,8 @@ class Command(BaseCommand):
exercise_id=exercise_id,
routine=routine,
repetitions=reps,
- repetitions_target=set_data.reps,
- repetitions_unit_id=set_data.reps_unit,
+ repetitions_target=set_data.repetitions,
+ repetitions_unit_id=set_data.repetitions_unit,
weight=weight,
weight_target=set_data.weight,
weight_unit_id=set_data.weight_unit,
diff --git a/wger/manager/managers.py b/wger/manager/managers.py
index 500491363..7a43daef6 100644
--- a/wger/manager/managers.py
+++ b/wger/manager/managers.py
@@ -21,7 +21,7 @@ from django.db import models
from wger.manager.consts import (
ID_UNIT_KG,
ID_UNIT_LB,
- ID_UNIT_REPS,
+ ID_UNIT_REPETITIONS,
)
@@ -36,7 +36,7 @@ class WorkoutLogQuerySet(models.QuerySet):
def reps(self):
"""Return all entries with reps as unit"""
- return self.filter(repetitions_unit_id=ID_UNIT_REPS)
+ return self.filter(repetitions_unit_id=ID_UNIT_REPETITIONS)
class WorkoutLogManager(models.Manager):
diff --git a/wger/manager/models/slot_entry.py b/wger/manager/models/slot_entry.py
index cf418407f..2cd843395 100644
--- a/wger/manager/models/slot_entry.py
+++ b/wger/manager/models/slot_entry.py
@@ -306,12 +306,12 @@ class SlotEntry(models.Model):
# TODO: decide on whether to return None or always the unit
# weight_unit=self.weight_unit.pk if weight is not None else None,
weight_unit=self.weight_unit.pk,
- reps=round_value(reps, self.repetition_rounding),
- max_reps=round_value(max_reps, self.repetition_rounding)
+ repetitions=round_value(reps, self.repetition_rounding),
+ max_repetitions=round_value(max_reps, self.repetition_rounding)
if max_reps and reps and max_reps > reps
else None,
- reps_rounding=self.repetition_rounding if reps is not None else None,
- reps_unit=self.repetition_unit.pk,
+ repetitions_rounding=self.repetition_rounding if reps is not None else None,
+ repetitions_unit=self.repetition_unit.pk,
# TODO: decide on whether to return None or always the unit
# reps_unit=self.repetition_unit.pk if reps is not None else None,
rir=self.calculate_rir(iteration),
diff --git a/wger/manager/tests/test_day.py b/wger/manager/tests/test_day.py
index 20a36dbec..efb63b11f 100644
--- a/wger/manager/tests/test_day.py
+++ b/wger/manager/tests/test_day.py
@@ -45,8 +45,8 @@ class DaySlotTestCase(WgerTestCase):
exercise=1,
weight=80,
weight_rounding=Decimal('1.25'),
- reps=4,
- reps_rounding=Decimal('1.00'),
+ repetitions=4,
+ repetitions_rounding=Decimal('1.00'),
rir=None,
rest=None,
sets=1,
@@ -56,8 +56,8 @@ class DaySlotTestCase(WgerTestCase):
exercise=2,
weight=20,
weight_rounding=Decimal('1.25'),
- reps=5,
- reps_rounding=Decimal('1.00'),
+ repetitions=5,
+ repetitions_rounding=Decimal('1.00'),
rir=None,
rest=None,
sets=1,
@@ -99,8 +99,8 @@ class DaySlotTestCase(WgerTestCase):
exercise=1,
weight=80,
weight_rounding=Decimal('1.25'),
- reps=Decimal(4),
- reps_rounding=Decimal('1.00'),
+ repetitions=Decimal(4),
+ repetitions_rounding=Decimal('1.00'),
rir=None,
rest=None,
sets=5,
@@ -115,8 +115,8 @@ class DaySlotTestCase(WgerTestCase):
exercise=2,
weight=20,
weight_rounding=Decimal('1.25'),
- reps=5,
- reps_rounding=Decimal('1.00'),
+ repetitions=5,
+ repetitions_rounding=Decimal('1.00'),
rir=None,
rest=None,
sets=2,
@@ -136,8 +136,8 @@ class DaySlotTestCase(WgerTestCase):
exercise=3,
weight=80,
weight_rounding=Decimal('1.25'),
- reps=6,
- reps_rounding=Decimal('1.00'),
+ repetitions=6,
+ repetitions_rounding=Decimal('1.00'),
rir=None,
rest=None,
sets=5,
@@ -153,8 +153,8 @@ class DaySlotTestCase(WgerTestCase):
exercise=3,
weight=50,
weight_rounding=Decimal('1.25'),
- reps=4,
- reps_rounding=Decimal('1.00'),
+ repetitions=4,
+ repetitions_rounding=Decimal('1.00'),
rir=None,
rest=None,
sets=3,
diff --git a/wger/manager/tests/test_routine_statistics.py b/wger/manager/tests/test_routine_statistics.py
index ba2293ed8..74767d26a 100644
--- a/wger/manager/tests/test_routine_statistics.py
+++ b/wger/manager/tests/test_routine_statistics.py
@@ -20,7 +20,7 @@ from wger.core.tests.base_testcase import WgerTestCase
from wger.manager.consts import (
ID_UNIT_KG,
ID_UNIT_LB,
- ID_UNIT_REPS,
+ ID_UNIT_REPETITIONS,
)
from wger.manager.dataclasses import LogData
from wger.manager.models import WorkoutLog
@@ -51,7 +51,7 @@ class RoutineStatisticsTestCase(WgerTestCase):
user_id=1,
routine=self.routine,
date=datetime.date(2024, 2, 1),
- repetitions_unit_id=ID_UNIT_REPS,
+ repetitions_unit_id=ID_UNIT_REPETITIONS,
repetitions=5,
weight_unit_id=ID_UNIT_KG,
weight=10,
@@ -64,7 +64,7 @@ class RoutineStatisticsTestCase(WgerTestCase):
user_id=1,
routine=self.routine,
date=datetime.date(2024, 2, 2),
- repetitions_unit_id=ID_UNIT_REPS,
+ repetitions_unit_id=ID_UNIT_REPETITIONS,
repetitions=1,
weight_unit_id=ID_UNIT_KG,
weight=10,
@@ -77,7 +77,7 @@ class RoutineStatisticsTestCase(WgerTestCase):
user_id=1,
routine=self.routine,
date=datetime.date(2024, 2, 10),
- repetitions_unit_id=ID_UNIT_REPS,
+ repetitions_unit_id=ID_UNIT_REPETITIONS,
repetitions=1,
weight_unit_id=ID_UNIT_KG,
weight=10,
@@ -90,7 +90,7 @@ class RoutineStatisticsTestCase(WgerTestCase):
user_id=1,
routine=self.routine,
date=datetime.date(2024, 2, 10),
- repetitions_unit_id=ID_UNIT_REPS,
+ repetitions_unit_id=ID_UNIT_REPETITIONS,
repetitions=1,
weight_unit_id=ID_UNIT_LB,
weight=10,
diff --git a/wger/manager/tests/test_set_config_data.py b/wger/manager/tests/test_set_config_data.py
index 13c32bb4e..bfb9879d0 100644
--- a/wger/manager/tests/test_set_config_data.py
+++ b/wger/manager/tests/test_set_config_data.py
@@ -31,8 +31,8 @@ class SetConfigDataTestCase(WgerTestCase):
exercise=1,
type='normal',
sets=1,
- reps=4,
- reps_unit=1,
+ repetitions=4,
+ repetitions_unit=1,
weight=20,
weight_unit=1,
rir=3,
@@ -73,19 +73,19 @@ class SetConfigDataTestCase(WgerTestCase):
self.assertEqual(self.config.text_repr, '4 × 20 kg @ 3 RiR')
def test_text_repr_reps_unit(self):
- self.config.reps = 90
- self.config.reps_unit = 3
+ self.config.repetitions = 90
+ self.config.repetitions_unit = 3
self.assertEqual(self.config.text_repr, '90 Seconds × 20 kg @ 3 RiR')
def test_text_repr_reps_unit_no_weight(self):
- self.config.reps = 90
- self.config.reps_unit = 3
+ self.config.repetitions = 90
+ self.config.repetitions_unit = 3
self.config.weight = None
self.assertEqual(self.config.text_repr, '90 Seconds @ 3 RiR')
def test_text_repr_reps_rounding(self):
- self.config.reps = 4.72
- self.config.reps_rounding = 2.5
+ self.config.repetitions = 4.72
+ self.config.repetitions_rounding = 2.5
self.assertEqual(self.config.text_repr, '5 × 20 kg @ 3 RiR')
def test_text_repr_rir_rounding(self):
@@ -93,11 +93,11 @@ class SetConfigDataTestCase(WgerTestCase):
self.assertEqual(self.config.text_repr, '4 × 20 kg @ 2.5 RiR')
def test_text_repr_amrap(self):
- self.config.reps_unit = 2
+ self.config.repetitions_unit = 2
self.assertEqual(self.config.text_repr, '∞ × 20 kg @ 3 RiR')
def test_text_repr_reps_range(self):
- self.config.max_reps = 6
+ self.config.max_repetitions = 6
self.assertEqual(self.config.text_repr, '4-6 × 20 kg @ 3 RiR')
def test_text_repr_weight_range(self):
@@ -125,8 +125,8 @@ class SetConfigDataTestCase(WgerTestCase):
self.config.sets = 3
self.config.weight = None
self.config.max_weight = None
- self.config.max_reps = None
- self.config.reps = None
+ self.config.max_repetitions = None
+ self.config.repetitions = None
self.config.rir = None
self.assertEqual(self.config.text_repr, '3 Sets')
diff --git a/wger/manager/tests/test_slot_entry.py b/wger/manager/tests/test_slot_entry.py
index a38ddd5fd..1e58462b8 100644
--- a/wger/manager/tests/test_slot_entry.py
+++ b/wger/manager/tests/test_slot_entry.py
@@ -181,8 +181,8 @@ class SlotEntryTestCase(WgerTestCase):
sets=4,
weight=Decimal(80),
weight_rounding=Decimal(2.5),
- reps=Decimal(4),
- reps_rounding=2,
+ repetitions=Decimal(4),
+ repetitions_rounding=2,
rir=Decimal(2),
rest=120,
),
@@ -196,8 +196,8 @@ class SlotEntryTestCase(WgerTestCase):
sets=4,
weight=Decimal(80),
weight_rounding=Decimal(2.5),
- reps=Decimal(4),
- reps_rounding=2,
+ repetitions=Decimal(4),
+ repetitions_rounding=2,
rir=Decimal(2),
rest=120,
),
@@ -211,8 +211,8 @@ class SlotEntryTestCase(WgerTestCase):
sets=4,
weight=Decimal(80),
weight_rounding=Decimal('2.5'),
- reps=Decimal(4),
- reps_rounding=2,
+ repetitions=Decimal(4),
+ repetitions_rounding=2,
rir=Decimal(2),
rest=120,
),
@@ -226,8 +226,8 @@ class SlotEntryTestCase(WgerTestCase):
sets=4,
weight=Decimal(82.5),
weight_rounding=Decimal('2.5'),
- reps=Decimal(4),
- reps_rounding=2,
+ repetitions=Decimal(4),
+ repetitions_rounding=2,
rir=Decimal(2),
rest=120,
),
@@ -241,8 +241,8 @@ class SlotEntryTestCase(WgerTestCase):
sets=4,
weight=Decimal('42.5'),
weight_rounding=Decimal('2.5'),
- reps=Decimal(4),
- reps_rounding=2,
+ repetitions=Decimal(4),
+ repetitions_rounding=2,
rir=Decimal(2),
rest=120,
),
@@ -256,8 +256,8 @@ class SlotEntryTestCase(WgerTestCase):
sets=4,
weight=Decimal(42.5),
weight_rounding=Decimal('2.5'),
- reps=Decimal(4),
- reps_rounding=2,
+ repetitions=Decimal(4),
+ repetitions_rounding=2,
rir=Decimal(2),
rest=120,
),
@@ -319,9 +319,9 @@ class SlotEntryTestCase(WgerTestCase):
weight=Decimal(80),
max_weight=Decimal(100),
weight_rounding=Decimal('2.5'),
- reps=Decimal(4),
- max_reps=Decimal(6),
- reps_rounding=2,
+ repetitions=Decimal(4),
+ max_repetitions=Decimal(6),
+ repetitions_rounding=2,
rir=None,
rest=None,
),
@@ -336,9 +336,9 @@ class SlotEntryTestCase(WgerTestCase):
weight=Decimal(80),
max_weight=Decimal(100),
weight_rounding=Decimal('2.5'),
- reps=Decimal(4),
- max_reps=Decimal(6),
- reps_rounding=2,
+ repetitions=Decimal(4),
+ max_repetitions=Decimal(6),
+ repetitions_rounding=2,
rir=None,
rest=None,
),
@@ -366,15 +366,15 @@ class SlotEntryTestCase(WgerTestCase):
self.assertEqual(
self.slot_entry.get_config(1),
- SetConfigData(exercise=1, sets=2, weight=24, reps=1, rir=2, rest=120),
+ SetConfigData(exercise=1, sets=2, weight=24, repetitions=1, rir=2, rest=120),
)
self.assertEqual(
self.slot_entry.get_config(2),
- SetConfigData(exercise=2, sets=4, weight=42, reps=10, rir=1, rest=90),
+ SetConfigData(exercise=2, sets=4, weight=42, repetitions=10, rir=1, rest=90),
)
self.assertEqual(
self.slot_entry.get_config(3),
- SetConfigData(exercise=2, sets=4, weight=42, reps=10, rir=1, rest=90),
+ SetConfigData(exercise=2, sets=4, weight=42, repetitions=10, rir=1, rest=90),
)
def test_empty_configs(self):
@@ -392,9 +392,9 @@ class SlotEntryTestCase(WgerTestCase):
weight=None,
weight_rounding=None,
weight_unit=1,
- reps=None,
- reps_rounding=None,
- reps_unit=1,
+ repetitions=None,
+ repetitions_rounding=None,
+ repetitions_unit=1,
rir=None,
rest=None,
),