From 41a445d8c3dfdeca5130cf875b0a34e336caf8ff Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Fri, 29 Nov 2024 11:34:25 +0100 Subject: [PATCH] Add 'not applicable' option This is basically a NULL option for the first iteration --- .../migrations/0018_flexible_routines.py | 54 +++++++++++++++---- wger/manager/models/abstract_config.py | 3 +- 2 files changed, 47 insertions(+), 10 deletions(-) diff --git a/wger/manager/migrations/0018_flexible_routines.py b/wger/manager/migrations/0018_flexible_routines.py index 7c23fdc51..5ad4332fd 100644 --- a/wger/manager/migrations/0018_flexible_routines.py +++ b/wger/manager/migrations/0018_flexible_routines.py @@ -390,7 +390,11 @@ class Migration(migrations.Migration): ( 'step', models.CharField( - choices=[('abs', 'Absolute'), ('percent', 'Percent')], + choices=[ + ('na', 'Not Applicable'), + ('abs', 'Absolute'), + ('percent', 'Percent'), + ], default='abs', max_length=10, null=False, @@ -437,7 +441,11 @@ class Migration(migrations.Migration): ( 'step', models.CharField( - choices=[('abs', 'Absolute'), ('percent', 'Percent')], + choices=[ + ('na', 'Not Applicable'), + ('abs', 'Absolute'), + ('percent', 'Percent'), + ], default='abs', max_length=10, null=False, @@ -490,7 +498,11 @@ class Migration(migrations.Migration): ( 'step', models.CharField( - choices=[('abs', 'Absolute'), ('percent', 'Percent')], + choices=[ + ('na', 'Not Applicable'), + ('abs', 'Absolute'), + ('percent', 'Percent'), + ], default='abs', max_length=10, null=False, @@ -593,7 +605,11 @@ class Migration(migrations.Migration): ( 'step', models.CharField( - choices=[('abs', 'Absolute'), ('percent', 'Percent')], + choices=[ + ('na', 'Not Applicable'), + ('abs', 'Absolute'), + ('percent', 'Percent'), + ], default='abs', max_length=10, null=False, @@ -640,7 +656,11 @@ class Migration(migrations.Migration): ( 'step', models.CharField( - choices=[('abs', 'Absolute'), ('percent', 'Percent')], + choices=[ + ('na', 'Not Applicable'), + ('abs', 'Absolute'), + ('percent', 'Percent'), + ], default='abs', max_length=10, null=False, @@ -687,7 +707,11 @@ class Migration(migrations.Migration): ( 'step', models.CharField( - choices=[('abs', 'Absolute'), ('percent', 'Percent')], + choices=[ + ('na', 'Not Applicable'), + ('abs', 'Absolute'), + ('percent', 'Percent'), + ], default='abs', max_length=10, null=False, @@ -734,7 +758,11 @@ class Migration(migrations.Migration): ( 'step', models.CharField( - choices=[('abs', 'Absolute'), ('percent', 'Percent')], + choices=[ + ('na', 'Not Applicable'), + ('abs', 'Absolute'), + ('percent', 'Percent'), + ], default='abs', max_length=10, null=False, @@ -781,7 +809,11 @@ class Migration(migrations.Migration): ( 'step', models.CharField( - choices=[('abs', 'Absolute'), ('percent', 'Percent')], + choices=[ + ('na', 'Not Applicable'), + ('abs', 'Absolute'), + ('percent', 'Percent'), + ], default='abs', max_length=10, null=False, @@ -828,7 +860,11 @@ class Migration(migrations.Migration): ( 'step', models.CharField( - choices=[('abs', 'Absolute'), ('percent', 'Percent')], + choices=[ + ('na', 'Not Applicable'), + ('abs', 'Absolute'), + ('percent', 'Percent'), + ], default='abs', max_length=10, ), diff --git a/wger/manager/models/abstract_config.py b/wger/manager/models/abstract_config.py index b32b3e3a0..85f749a25 100644 --- a/wger/manager/models/abstract_config.py +++ b/wger/manager/models/abstract_config.py @@ -25,6 +25,7 @@ class OperationChoices(models.TextChoices): class StepChoices(models.TextChoices): + NOT_APPLICABLE = 'na' ABSOLUTE = 'abs' PERCENT = 'percent' @@ -105,7 +106,7 @@ def save(self, **kwargs): # Override values for replace if self.replace: self.need_log_to_apply = False - self.step = 'abs' + self.step = StepChoices.NOT_APPLICABLE super().save(**kwargs)