From 00100c5cbad107637195d96d29aadcb850a2163a Mon Sep 17 00:00:00 2001 From: Fizzlepoof Date: Thu, 28 May 2026 18:33:05 +0000 Subject: [PATCH] Correct Doris Barbell 7-7-7 and punch-out routines --- home/doris-barbell/app/services/store.py | 25 +++++-- home/doris-barbell/tests/test_app.py | 88 ++++++++++++++++++++++++ 2 files changed, 108 insertions(+), 5 deletions(-) diff --git a/home/doris-barbell/app/services/store.py b/home/doris-barbell/app/services/store.py index 7c5dfa6..df66e17 100644 --- a/home/doris-barbell/app/services/store.py +++ b/home/doris-barbell/app/services/store.py @@ -52,7 +52,7 @@ SEEDED_EXERCISE_TEMPLATES = [ {'name': 'Upright Row', 'primary_muscle': 'shoulders', 'equipment': 'barbell'}, {'name': 'Shoulder Shrugs', 'primary_muscle': 'traps', 'equipment': 'dumbbells'}, {'name': '7-7-7 Shoulder Press', 'primary_muscle': 'shoulders', 'equipment': 'machine'}, - {'name': 'Resistance Band Punch-Out Holds', 'primary_muscle': 'abs', 'equipment': 'band'}, + {'name': 'Resistance Band Punch-Out Training', 'primary_muscle': 'shoulders', 'equipment': 'band'}, {'name': 'Squats', 'primary_muscle': 'legs', 'equipment': 'barbell'}, {'name': 'Leg Extensions', 'primary_muscle': 'quads', 'equipment': 'machine'}, {'name': 'Step Ups', 'primary_muscle': 'legs', 'equipment': 'bodyweight'}, @@ -96,14 +96,14 @@ SEEDED_ROUTINES = [ {'exercise_name': 'Overhead Tricep Extensions', 'target_sets': 3, 'target_reps': '10'}, {'exercise_name': 'Incline Barbell Curls', 'target_sets': 3, 'target_reps': '10'}, {'exercise_name': 'Isolation Bicep Curls', 'target_sets': 3, 'target_reps': '10'}, - {'exercise_name': '7-7-7 Barbell Curl', 'target_sets': 3, 'target_reps': '10'}, + {'exercise_name': '7-7-7 Barbell Curl', 'target_sets': 1, 'target_reps': '7-7-7'}, {'exercise_name': 'Suitcase Carry', 'target_sets': 3, 'target_reps': '10'}, ], }, { 'user_id': 'john', 'name': 'Thursday: Shoulders', - 'notes': "Imported from John's current routine. Default prescription is 3 sets of 10 reps. Weights are still TBD. Includes resistance band punch-out ab holds.", + 'notes': "Imported from John's current routine. Default prescription is 3 sets of 10 reps. Weights are still TBD. Includes resistance band punch-out training.", 'exercises': [ {'exercise_name': 'Shoulder Press', 'target_sets': 3, 'target_reps': '10'}, {'exercise_name': 'Arnold Press', 'target_sets': 3, 'target_reps': '10'}, @@ -111,8 +111,8 @@ SEEDED_ROUTINES = [ {'exercise_name': 'Front Lateral Raise', 'target_sets': 3, 'target_reps': '10'}, {'exercise_name': 'Upright Row', 'target_sets': 3, 'target_reps': '10'}, {'exercise_name': 'Shoulder Shrugs', 'target_sets': 3, 'target_reps': '10'}, - {'exercise_name': '7-7-7 Shoulder Press', 'target_sets': 3, 'target_reps': '10'}, - {'exercise_name': 'Resistance Band Punch-Out Holds', 'target_sets': 3, 'target_reps': '10'}, + {'exercise_name': '7-7-7 Shoulder Press', 'target_sets': 1, 'target_reps': '7-7-7'}, + {'exercise_name': 'Resistance Band Punch-Out Training', 'target_sets': 3, 'target_reps': '10'}, ], }, { @@ -157,6 +157,10 @@ DEFAULT_STATE = { 'workout_sessions': [], } +LEGACY_TEMPLATE_ALIASES = { + 'resistance band punch-out holds': 'Resistance Band Punch-Out Training', +} + class JSONStore: def __init__(self, state_dir: Path) -> None: @@ -422,6 +426,17 @@ def _ensure_seeded_library(state: dict[str, Any]) -> dict[str, Any]: payload.setdefault('measurement_entries', []) payload.setdefault('workout_sessions', []) + for template in payload['exercise_templates']: + legacy_name = template.get('name', '').strip().lower() + replacement_name = LEGACY_TEMPLATE_ALIASES.get(legacy_name) + if replacement_name is None: + continue + seeded_template = next(item for item in SEEDED_EXERCISE_TEMPLATES if item['name'] == replacement_name) + template['name'] = seeded_template['name'] + template['primary_muscle'] = seeded_template.get('primary_muscle') + template['equipment'] = seeded_template.get('equipment') + template['notes'] = seeded_template.get('notes') + existing_template_names = { item.get('name', '').strip().lower() for item in payload['exercise_templates'] diff --git a/home/doris-barbell/tests/test_app.py b/home/doris-barbell/tests/test_app.py index b02dc09..08d31c1 100644 --- a/home/doris-barbell/tests/test_app.py +++ b/home/doris-barbell/tests/test_app.py @@ -55,6 +55,18 @@ def test_dashboard_summary_seeds_john_and_manndra(tmp_path: Path) -> None: } assert '3 sets of 10 reps' in payload['routines'][0]['notes'] assert 'Weights are still TBD' in payload['routines'][0]['notes'] + shoulders = next(routine for routine in payload['routines'] if routine['name'] == 'Thursday: Shoulders') + assert shoulders['exercises'][6] == { + 'exercise_name': '7-7-7 Shoulder Press', + 'target_sets': 1, + 'target_reps': '7-7-7', + } + assert shoulders['exercises'][7] == { + 'exercise_name': 'Resistance Band Punch-Out Training', + 'target_sets': 3, + 'target_reps': '10', + } + assert 'resistance band punch-out training' in shoulders['notes'] template_names = [template['name'] for template in payload['exercise_templates']] assert template_names == [ 'Resistance Band Crunches', @@ -546,6 +558,82 @@ def test_existing_seeded_routines_upgrade_prescriptions_to_three_by_ten(tmp_path assert 'Weights are still TBD' in monday['notes'] +def test_existing_seeded_shoulders_routine_gets_777_and_punch_out_corrections(tmp_path: Path) -> None: + state_path = tmp_path / 'state.json' + state_path.write_text( + json.dumps( + { + 'users': { + 'john': { + 'id': 'john', + 'display_name': 'John', + 'is_stub': False, + 'measurement_system': 'imperial', + 'height_inches': 68.5, + 'goal_weight_lbs': None, + 'notes': 'Legacy state', + }, + 'manndra': { + 'id': 'manndra', + 'display_name': 'Manndra', + 'is_stub': True, + 'measurement_system': 'imperial', + 'height_inches': None, + 'goal_weight_lbs': None, + 'notes': 'Legacy stub', + }, + }, + 'exercise_templates': [ + { + 'id': 'seed-template-25', + 'name': 'Resistance Band Punch-Out Holds', + 'primary_muscle': 'abs', + 'equipment': 'band', + 'notes': None, + } + ], + 'routines': [ + { + 'id': 'seed-routine-04', + 'user_id': 'john', + 'name': 'Thursday: Shoulders', + 'notes': "Imported from John's current routine. Default prescription is 3 sets of 10 reps. Weights are still TBD. Includes resistance band punch-out ab holds.", + 'exercises': [ + {'exercise_name': 'Shoulder Press', 'target_sets': 3, 'target_reps': '10'}, + {'exercise_name': 'Arnold Press', 'target_sets': 3, 'target_reps': '10'}, + {'exercise_name': 'Side Lateral Raise', 'target_sets': 3, 'target_reps': '10'}, + {'exercise_name': 'Front Lateral Raise', 'target_sets': 3, 'target_reps': '10'}, + {'exercise_name': 'Upright Row', 'target_sets': 3, 'target_reps': '10'}, + {'exercise_name': 'Shoulder Shrugs', 'target_sets': 3, 'target_reps': '10'}, + {'exercise_name': '7-7-7 Shoulder Press', 'target_sets': 3, 'target_reps': '10'}, + {'exercise_name': 'Resistance Band Punch-Out Holds', 'target_sets': 3, 'target_reps': '10'}, + ], + } + ], + 'weight_entries': [], + 'measurement_entries': [], + 'workout_sessions': [], + } + ) + ) + + client = make_client(tmp_path) + payload = client.get('/api/dashboard/summary').json() + + shoulders = next(routine for routine in payload['routines'] if routine['name'] == 'Thursday: Shoulders') + assert shoulders['exercises'][6] == { + 'exercise_name': '7-7-7 Shoulder Press', + 'target_sets': 1, + 'target_reps': '7-7-7', + } + assert shoulders['exercises'][7] == { + 'exercise_name': 'Resistance Band Punch-Out Training', + 'target_sets': 3, + 'target_reps': '10', + } + assert 'resistance band punch-out training' in shoulders['notes'] + + def test_weight_form_submission_redirects_and_updates_dashboard(tmp_path: Path) -> None: client = make_client(tmp_path)