Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Remove trigger field

Roland Geiderc4c656335786
diff --git a/wger/manager/api/serializers.py b/wger/manager/api/serializers.py
index 4440e3707..9cc1ebb6c 100644
--- a/wger/manager/api/serializers.py
+++ b/wger/manager/api/serializers.py
@@ -89,7 +89,6 @@ class WeightConfigSerializer(serializers.ModelSerializer):
'id',
'slot_config',
'iteration',
- 'trigger',
'value',
'operation',
'step',
@@ -109,7 +108,6 @@ class RepsConfigSerializer(serializers.ModelSerializer):
'id',
'slot_config',
'iteration',
- 'trigger',
'value',
'operation',
'step',
@@ -129,7 +127,6 @@ class SetNrConfigSerializer(serializers.ModelSerializer):
'id',
'slot_config',
'iteration',
- 'trigger',
'value',
'operation',
'step',
@@ -148,7 +145,6 @@ class RiRConfigSerializer(serializers.ModelSerializer):
'id',
'slot_config',
'iteration',
- 'trigger',
'value',
'operation',
'step',
@@ -167,7 +163,6 @@ class RestConfigSerializer(serializers.ModelSerializer):
'id',
'slot_config',
'iteration',
- 'trigger',
'value',
'operation',
'step',
diff --git a/wger/manager/fixtures/test-routine-data.json b/wger/manager/fixtures/test-routine-data.json
index bb0d854f8..1e1f1e06b 100644
--- a/wger/manager/fixtures/test-routine-data.json
+++ b/wger/manager/fixtures/test-routine-data.json
@@ -159,7 +159,6 @@
"fields": {
"slot_config_id": 1,
"iteration": 1,
- "trigger": "session",
"value": 5,
"operation": null,
"step": null,
@@ -173,7 +172,6 @@
"fields": {
"slot_config_id": 2,
"iteration": 1,
- "trigger": "session",
"value": 2,
"operation": null,
"step": null,
@@ -187,7 +185,6 @@
"fields": {
"slot_config_id": 3,
"iteration": 1,
- "trigger": "session",
"value": 5,
"operation": null,
"step": null,
@@ -201,7 +198,6 @@
"fields": {
"slot_config_id": 4,
"iteration": 1,
- "trigger": "session",
"value": 3,
"operation": null,
"step": null,
@@ -215,7 +211,6 @@
"fields": {
"slot_config_id": 1,
"iteration": 1,
- "trigger": "session",
"value": 80,
"operation": null,
"step": null,
@@ -229,7 +224,6 @@
"fields": {
"slot_config_id": 2,
"iteration": 1,
- "trigger": "session",
"value": 20,
"operation": null,
"step": null,
@@ -243,7 +237,6 @@
"fields": {
"slot_config_id": 3,
"iteration": 1,
- "trigger": "session",
"value": 80,
"operation": null,
"step": null,
@@ -257,7 +250,6 @@
"fields": {
"slot_config_id": 4,
"iteration": 1,
- "trigger": "session",
"value": 50,
"operation": null,
"step": null,
@@ -271,7 +263,6 @@
"fields": {
"slot_config_id": 1,
"iteration": 1,
- "trigger": "session",
"value": 4,
"operation": null,
"step": null,
@@ -285,7 +276,6 @@
"fields": {
"slot_config_id": 2,
"iteration": 1,
- "trigger": "session",
"value": 5,
"operation": null,
"step": null,
@@ -299,7 +289,6 @@
"fields": {
"slot_config_id": 3,
"iteration": 1,
- "trigger": "session",
"value": 6,
"operation": null,
"step": null,
@@ -313,7 +302,6 @@
"fields": {
"slot_config_id": 4,
"iteration": 1,
- "trigger": "session",
"value": 4,
"operation": null,
"step": null,
diff --git a/wger/manager/migrations/0018_flexible_routines.py b/wger/manager/migrations/0018_flexible_routines.py
index 2178cb9a4..b127cb666 100644
--- a/wger/manager/migrations/0018_flexible_routines.py
+++ b/wger/manager/migrations/0018_flexible_routines.py
@@ -31,7 +31,7 @@ class Migration(migrations.Migration):
'type',
models.CharField(
choices=[
- ('normal', 'Normal'),
+ ('custom', 'Custom'),
('enom', 'Emom'),
('amrap', 'Amrap'),
('hiit', 'Hiit'),
@@ -339,15 +339,6 @@ class Migration(migrations.Migration):
),
),
('iteration', models.PositiveIntegerField()),
- (
- 'trigger',
- models.CharField(
- choices=[('session', 'Session'), ('week', 'Week')],
- default='session',
- max_length=10,
- null=True,
- ),
- ),
('value', models.DecimalField(decimal_places=2, max_digits=6)),
(
'operation',
@@ -396,15 +387,6 @@ class Migration(migrations.Migration):
),
),
('iteration', models.PositiveIntegerField()),
- (
- 'trigger',
- models.CharField(
- choices=[('session', 'Session'), ('week', 'Week')],
- default='session',
- max_length=10,
- null=True,
- ),
- ),
('value', models.DecimalField(decimal_places=2, max_digits=6)),
(
'operation',
@@ -453,15 +435,6 @@ class Migration(migrations.Migration):
),
),
('iteration', models.PositiveIntegerField()),
- (
- 'trigger',
- models.CharField(
- choices=[('session', 'Session'), ('week', 'Week')],
- default='session',
- max_length=10,
- null=True,
- ),
- ),
('value', models.DecimalField(decimal_places=2, max_digits=6)),
(
'operation',
@@ -510,15 +483,6 @@ class Migration(migrations.Migration):
),
),
('iteration', models.PositiveIntegerField()),
- (
- 'trigger',
- models.CharField(
- choices=[('session', 'Session'), ('week', 'Week')],
- default='session',
- max_length=10,
- null=True,
- ),
- ),
('value', models.DecimalField(decimal_places=2, max_digits=6)),
(
'operation',
@@ -567,15 +531,6 @@ class Migration(migrations.Migration):
),
),
('iteration', models.PositiveIntegerField()),
- (
- 'trigger',
- models.CharField(
- choices=[('session', 'Session'), ('week', 'Week')],
- default='session',
- max_length=10,
- null=True,
- ),
- ),
('value', models.DecimalField(decimal_places=2, max_digits=6)),
(
'operation',
@@ -624,15 +579,6 @@ class Migration(migrations.Migration):
),
),
('iteration', models.PositiveIntegerField()),
- (
- 'trigger',
- models.CharField(
- choices=[('session', 'Session'), ('week', 'Week')],
- default='session',
- max_length=10,
- null=True,
- ),
- ),
('value', models.DecimalField(decimal_places=2, max_digits=6)),
(
'operation',
@@ -680,15 +626,6 @@ class Migration(migrations.Migration):
),
),
('iteration', models.PositiveIntegerField()),
- (
- 'trigger',
- models.CharField(
- choices=[('session', 'Session'), ('week', 'Week')],
- default='session',
- max_length=10,
- null=True,
- ),
- ),
('value', models.DecimalField(decimal_places=2, max_digits=6)),
(
'operation',
@@ -736,15 +673,6 @@ class Migration(migrations.Migration):
),
),
('iteration', models.PositiveIntegerField()),
- (
- 'trigger',
- models.CharField(
- choices=[('session', 'Session'), ('week', 'Week')],
- default='session',
- max_length=10,
- null=True,
- ),
- ),
('value', models.DecimalField(decimal_places=2, max_digits=6)),
(
'operation',
diff --git a/wger/manager/models/abstract_config.py b/wger/manager/models/abstract_config.py
index 2d58f0614..fca7c4811 100644
--- a/wger/manager/models/abstract_config.py
+++ b/wger/manager/models/abstract_config.py
@@ -23,11 +23,6 @@ class OperationChoices(models.TextChoices):
MINUS = '-'
-class TriggerChoices(models.TextChoices):
- SESSION = 'session'
- WEEK = 'week'
-
-
class StepChoices(models.TextChoices):
ABSOLUTE = 'abs'
PERCENT = 'percent'
@@ -51,19 +46,8 @@ class AbstractChangeConfig(models.Model):
iteration = models.PositiveIntegerField()
"""
The iteration this takes effect on.
-
- Note that what exactly an iteration is depends on the trigger type so
- at the moment this can be session (so basically a day) or a week.
"""
- trigger = models.CharField(
- choices=TriggerChoices.choices,
- max_length=10,
- default=TriggerChoices.SESSION,
- null=True,
- )
- """When the changes are calculated"""
-
value = models.DecimalField(
decimal_places=2,
max_digits=6,
diff --git a/wger/manager/models/day.py b/wger/manager/models/day.py
index b50a2349a..39152beb7 100644
--- a/wger/manager/models/day.py
+++ b/wger/manager/models/day.py
@@ -28,7 +28,7 @@ from wger.manager.dataclasses import SlotData
class DayType(models.TextChoices):
- NORMAL = 'normal'
+ CUSTOM = 'custom'
EMOM = 'enom'
AMRAP = 'amrap'
HIIT = 'hiit'
@@ -60,7 +60,7 @@ class DayNg(models.Model):
type = models.CharField(
choices=DayType.choices,
max_length=10,
- default=DayType.NORMAL,
+ default=DayType.CUSTOM,
null=False,
)