Skip to content

Commit

Permalink
Add requirements field for progression rules
Browse files Browse the repository at this point in the history
This will allow to store the requirements needed for the rule to apply
  • Loading branch information
rolandgeider committed Nov 29, 2024
1 parent 41a445d commit 67b6396
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
40 changes: 40 additions & 0 deletions wger/manager/migrations/0018_flexible_routines.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,10 @@ class Migration(migrations.Migration):
to='manager.slotentry',
),
),
(
'requirements',
models.JSONField(default=None, null=True),
)
],
options={
'ordering': ['slot_entry', 'iteration'],
Expand Down Expand Up @@ -460,6 +464,10 @@ class Migration(migrations.Migration):
to='manager.slotentry',
),
),
(
'requirements',
models.JSONField(default=None, null=True),
)
],
options={
'ordering': ['slot_entry', 'iteration'],
Expand Down Expand Up @@ -517,6 +525,10 @@ class Migration(migrations.Migration):
to='manager.slotentry',
),
),
(
'requirements',
models.JSONField(default=None, null=True),
)
],
options={
'ordering': ['slot_entry', 'iteration'],
Expand Down Expand Up @@ -573,6 +585,10 @@ class Migration(migrations.Migration):
to='manager.slotentry',
),
),
(
'requirements',
models.JSONField(default=None, null=True),
)
],
options={
'ordering': ['slot_entry', 'iteration'],
Expand Down Expand Up @@ -624,6 +640,10 @@ class Migration(migrations.Migration):
to='manager.slotentry',
),
),
(
'requirements',
models.JSONField(default=None, null=True),
)
],
options={
'ordering': ['slot_entry', 'iteration'],
Expand Down Expand Up @@ -675,6 +695,10 @@ class Migration(migrations.Migration):
to='manager.slotentry',
),
),
(
'requirements',
models.JSONField(default=None, null=True),
)
],
options={
'ordering': ['slot_entry', 'iteration'],
Expand Down Expand Up @@ -726,6 +750,10 @@ class Migration(migrations.Migration):
to='manager.slotentry',
),
),
(
'requirements',
models.JSONField(default=None, null=True),
)
],
options={
'ordering': ['slot_entry', 'iteration'],
Expand Down Expand Up @@ -777,6 +805,10 @@ class Migration(migrations.Migration):
to='manager.slotentry',
),
),
(
'requirements',
models.JSONField(default=None, null=True),
)
],
options={
'ordering': ['slot_entry', 'iteration'],
Expand Down Expand Up @@ -828,6 +860,10 @@ class Migration(migrations.Migration):
to='manager.slotentry',
),
),
(
'requirements',
models.JSONField(default=None, null=True),
)
],
options={
'ordering': ['slot_entry', 'iteration'],
Expand Down Expand Up @@ -878,6 +914,10 @@ class Migration(migrations.Migration):
to='manager.slotentry',
),
),
(
'requirements',
models.JSONField(default=None, null=True),
)
],
options={
'ordering': ['slot_entry', 'iteration'],
Expand Down
8 changes: 7 additions & 1 deletion wger/manager/models/abstract_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,14 @@ class Meta:
different change.
"""

requirements = models.JSONField(
default=None,
null=True,
)
"""Requirements for the application of this rule as JSON"""

@property
def replace(self):
def replace(self) -> bool:
"""
Flag indicating that there is no increase, but that the value will simply
be replaced with the new one
Expand Down

0 comments on commit 67b6396

Please sign in to comment.