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:
@@ -938,6 +938,16 @@ def preview_day(request):
|
||||
|
||||
# Optional plan_id: exclude exercises from sibling workouts in the same plan (Item #9)
|
||||
plan_id = request.data.get('plan_id')
|
||||
if plan_id in ('', None):
|
||||
plan_id = None
|
||||
elif not isinstance(plan_id, int):
|
||||
try:
|
||||
plan_id = int(plan_id)
|
||||
except (TypeError, ValueError):
|
||||
return Response(
|
||||
{'error': 'plan_id must be an integer.'},
|
||||
status=status.HTTP_400_BAD_REQUEST,
|
||||
)
|
||||
|
||||
try:
|
||||
from generator.services.workout_generator import WorkoutGenerator
|
||||
@@ -945,7 +955,7 @@ def preview_day(request):
|
||||
generator = WorkoutGenerator(preference)
|
||||
|
||||
# If plan_id is provided, exclude sibling workout exercises
|
||||
if plan_id:
|
||||
if plan_id is not None:
|
||||
try:
|
||||
plan = GeneratedWeeklyPlan.objects.get(
|
||||
pk=plan_id,
|
||||
@@ -974,6 +984,8 @@ def preview_day(request):
|
||||
workout_type=workout_type,
|
||||
scheduled_date=scheduled_date,
|
||||
)
|
||||
if plan_id is not None:
|
||||
day_preview['plan_id'] = plan_id
|
||||
except Exception as e:
|
||||
return Response(
|
||||
{'error': f'Day preview generation failed: {str(e)}'},
|
||||
|
||||
Reference in New Issue
Block a user