Unraid deployment fixes and generator improvements

- Add Next.js rewrites to proxy API calls through same origin (fixes login/media on werkout.treytartt.com)
- Fix mediaUrl() in DayCard and ExerciseRow to use relative paths in production
- Add proxyTimeout for long-running workout generation endpoints
- Add CSRF trusted origin for treytartt.com
- Split docker-compose into production (Unraid) and dev configs
- Show display_name and descriptions on workout type cards
- Generator: rules engine improvements, movement enforcement, exercise selector updates
- Add new test files for rules drift, workout research generation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Trey t
2026-02-23 10:25:45 -06:00
parent 1c61b80731
commit 03681c532d
21 changed files with 2366 additions and 138 deletions

View File

@@ -210,3 +210,42 @@ class TestWeeklySplit(TestCase):
bad_pattern.delete()
pref.delete()
@patch('generator.services.workout_generator.random.random', return_value=0.0)
def test_diversifies_repetitive_four_day_pattern(self, _mock_random):
"""
A 4-day DB pattern with 3 lower-body days should be diversified so
split_type repetition does not dominate the week.
"""
lower_a = MuscleGroupSplit.objects.create(
muscle_names=['glutes', 'hamstrings', 'core'],
label='Lower A',
split_type='lower',
frequency=9,
)
lower_b = MuscleGroupSplit.objects.create(
muscle_names=['quads', 'glutes', 'calves'],
label='Lower B',
split_type='lower',
frequency=9,
)
WeeklySplitPattern.objects.create(
days_per_week=4,
pattern=[self.lower.pk, lower_a.pk, lower_b.pk, self.full_body.pk],
pattern_labels=['Lower', 'Lower A', 'Lower B', 'Full Body'],
frequency=50,
)
pref = self._make_preference(days_per_week=4)
gen = self._make_generator(pref)
splits, _ = gen._pick_weekly_split()
self.assertEqual(len(splits), 4)
split_type_counts = Counter(s['split_type'] for s in splits)
self.assertLessEqual(
split_type_counts.get('lower', 0), 2,
f"Expected diversification to avoid 3+ lower days, got: {split_type_counts}",
)
pref.delete()