workout generator audit: rules engine, structure rules, split patterns, injury UX, metadata cleanup
- Add rules_engine.py with quantitative rules for all 8 workout types - Add quality gate retry loop in generate_single_workout() - Expand calibrate_structure_rules to all 120 combinations (8 types × 5 goals × 3 sections) - Wire WeeklySplitPattern DB records into _pick_weekly_split() - Enforce movement patterns from WorkoutStructureRule in exercise selection - Add straight-set strength support (single main lift, 4-6 rounds) - Add modality consistency check for duration-dominant workout types - Add InjuryStep component to onboarding and preferences - Add sibling exercise exclusion in regenerate and preview_day endpoints - Display generator warnings on dashboard - Expand fix_rep_durations, fix_exercise_flags, fix_movement_pattern_typo - Add audit_exercise_data and check_rules_drift management commands - Add Next.js frontend with dashboard, onboarding, preferences, history pages - Add generator app with ML-powered workout generation pipeline - 96 new tests across 7 test modules Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
# Generated by Django 5.1.4 on 2026-02-21 05:06
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
def deduplicate_workout_equipment(apps, schema_editor):
|
||||
"""Remove duplicate WorkoutEquipment rows before adding unique constraint."""
|
||||
WorkoutEquipment = apps.get_model('equipment', 'WorkoutEquipment')
|
||||
seen = set()
|
||||
to_delete = []
|
||||
for we in WorkoutEquipment.objects.all().order_by('id'):
|
||||
key = (we.exercise_id, we.equipment_id)
|
||||
if key in seen:
|
||||
to_delete.append(we.id)
|
||||
else:
|
||||
seen.add(key)
|
||||
if to_delete:
|
||||
WorkoutEquipment.objects.filter(id__in=to_delete).delete()
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('equipment', '0002_workoutequipment'),
|
||||
('exercise', '0010_alter_exercise_complexity_rating_and_more'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(deduplicate_workout_equipment, migrations.RunPython.noop),
|
||||
migrations.AlterUniqueTogether(
|
||||
name='workoutequipment',
|
||||
unique_together={('exercise', 'equipment')},
|
||||
),
|
||||
]
|
||||
@@ -26,5 +26,8 @@ class WorkoutEquipment(models.Model):
|
||||
related_name='workout_exercise_workout'
|
||||
)
|
||||
|
||||
class Meta:
|
||||
unique_together = ('exercise', 'equipment')
|
||||
|
||||
def __str__(self):
|
||||
return self.exercise.name + " : " + self.equipment.name
|
||||
Reference in New Issue
Block a user