Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Handle empty workout names and update repetition and weight units

Roland Geider1d62ee33653e
diff --git a/wger/manager/migrations/0019_flexible_routines_migration.py b/wger/manager/migrations/0019_flexible_routines_migration.py
index 5ad761f54..7f7b4d634 100644
--- a/wger/manager/migrations/0019_flexible_routines_migration.py
+++ b/wger/manager/migrations/0019_flexible_routines_migration.py
@@ -37,7 +37,7 @@ def migrate_routines(apps) -> dict[int, Any]:
next_monday = workout.creation_date + timedelta(days=7 - workout.creation_date.weekday())
routine = Routine(
- name=workout.name[:25],
+ name=workout.name[:25] if workout.name else 'Routine',
description=workout.description,
user=workout.user,
created=workout.creation_date,
@@ -83,14 +83,14 @@ def migrate_routines(apps) -> dict[int, Any]:
slot_entry = SlotEntry(
slot=slot,
exercise=setting.exercise_base,
- # default "reps"
repetition_unit_id=setting.repetition_unit_id
- if setting.repetition_unit_id is not None
- else 1,
- # default "kg"
+ if setting.reps is not None
+ else None,
+
weight_unit_id=setting.weight_unit_id
- if setting.weight_unit_id is not None
- else 1,
+ if setting.weight is not None
+ else None,
+
order=setting.order,
comment=setting.comment,
)
@@ -123,14 +123,6 @@ def migrate_routines(apps) -> dict[int, Any]:
step=ABS_STEP,
).save()
- RestConfig(
- slot_entry=slot_entry,
- value=120,
- iteration=1,
- operation=REPLACE_OP,
- step=ABS_STEP,
- ).save()
-
SetsConfig(
slot_entry=slot_entry,
value=nr_sets,