Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Change max routine name length and fix day name

Roland Geider615adfb5d0f6
diff --git a/wger/manager/migrations/0018_flexible_routines.py b/wger/manager/migrations/0018_flexible_routines.py
index afe4e4c4a..794f6d984 100644
--- a/wger/manager/migrations/0018_flexible_routines.py
+++ b/wger/manager/migrations/0018_flexible_routines.py
@@ -349,7 +349,7 @@ class Migration(migrations.Migration):
'name',
models.CharField(
blank=True,
- max_length=50,
+ max_length=25,
verbose_name='Name',
),
),
diff --git a/wger/manager/migrations/0019_flexible_routines_migration.py b/wger/manager/migrations/0019_flexible_routines_migration.py
index 7dbc40310..0bcd735cb 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[:50],
+ name=workout.name[:25],
description=workout.description,
user=workout.user,
created=workout.creation_date,
@@ -65,8 +65,8 @@ def migrate_routines(apps) -> dict[int, Any]:
day = workout.day_set.filter(day__id=i).first()
if day:
- current_day.name = day.description if len(day.description) <= 50 else f'Day {i}'
- current_day.description = day.description if len(day.description) > 50 else ''
+ current_day.name = day.description[:20]
+ current_day.description = day.description
current_day.is_rest = False
current_day.need_logs_to_advance = False
current_day.save()
diff --git a/wger/manager/models/routine.py b/wger/manager/models/routine.py
index 41a503e7c..70647a7b2 100644
--- a/wger/manager/models/routine.py
+++ b/wger/manager/models/routine.py
@@ -67,7 +67,7 @@ class Routine(models.Model):
name = models.CharField(
verbose_name=_('Name'),
- max_length=50,
+ max_length=25,
blank=True,
)