Correct Doris Barbell 7-7-7 and punch-out routines
This commit is contained in:
@@ -52,7 +52,7 @@ SEEDED_EXERCISE_TEMPLATES = [
|
|||||||
{'name': 'Upright Row', 'primary_muscle': 'shoulders', 'equipment': 'barbell'},
|
{'name': 'Upright Row', 'primary_muscle': 'shoulders', 'equipment': 'barbell'},
|
||||||
{'name': 'Shoulder Shrugs', 'primary_muscle': 'traps', 'equipment': 'dumbbells'},
|
{'name': 'Shoulder Shrugs', 'primary_muscle': 'traps', 'equipment': 'dumbbells'},
|
||||||
{'name': '7-7-7 Shoulder Press', 'primary_muscle': 'shoulders', 'equipment': 'machine'},
|
{'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': 'Squats', 'primary_muscle': 'legs', 'equipment': 'barbell'},
|
||||||
{'name': 'Leg Extensions', 'primary_muscle': 'quads', 'equipment': 'machine'},
|
{'name': 'Leg Extensions', 'primary_muscle': 'quads', 'equipment': 'machine'},
|
||||||
{'name': 'Step Ups', 'primary_muscle': 'legs', 'equipment': 'bodyweight'},
|
{'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': 'Overhead Tricep Extensions', 'target_sets': 3, 'target_reps': '10'},
|
||||||
{'exercise_name': 'Incline Barbell Curls', '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': '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'},
|
{'exercise_name': 'Suitcase Carry', 'target_sets': 3, 'target_reps': '10'},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'user_id': 'john',
|
'user_id': 'john',
|
||||||
'name': 'Thursday: Shoulders',
|
'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': [
|
'exercises': [
|
||||||
{'exercise_name': 'Shoulder Press', 'target_sets': 3, 'target_reps': '10'},
|
{'exercise_name': 'Shoulder Press', 'target_sets': 3, 'target_reps': '10'},
|
||||||
{'exercise_name': 'Arnold 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': 'Front Lateral Raise', 'target_sets': 3, 'target_reps': '10'},
|
||||||
{'exercise_name': 'Upright Row', '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': 'Shoulder Shrugs', 'target_sets': 3, 'target_reps': '10'},
|
||||||
{'exercise_name': '7-7-7 Shoulder Press', '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 Holds', 'target_sets': 3, 'target_reps': '10'},
|
{'exercise_name': 'Resistance Band Punch-Out Training', 'target_sets': 3, 'target_reps': '10'},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -157,6 +157,10 @@ DEFAULT_STATE = {
|
|||||||
'workout_sessions': [],
|
'workout_sessions': [],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LEGACY_TEMPLATE_ALIASES = {
|
||||||
|
'resistance band punch-out holds': 'Resistance Band Punch-Out Training',
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class JSONStore:
|
class JSONStore:
|
||||||
def __init__(self, state_dir: Path) -> None:
|
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('measurement_entries', [])
|
||||||
payload.setdefault('workout_sessions', [])
|
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 = {
|
existing_template_names = {
|
||||||
item.get('name', '').strip().lower()
|
item.get('name', '').strip().lower()
|
||||||
for item in payload['exercise_templates']
|
for item in payload['exercise_templates']
|
||||||
|
|||||||
@@ -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 '3 sets of 10 reps' in payload['routines'][0]['notes']
|
||||||
assert 'Weights are still TBD' 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']]
|
template_names = [template['name'] for template in payload['exercise_templates']]
|
||||||
assert template_names == [
|
assert template_names == [
|
||||||
'Resistance Band Crunches',
|
'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']
|
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:
|
def test_weight_form_submission_redirects_and_updates_dashboard(tmp_path: Path) -> None:
|
||||||
client = make_client(tmp_path)
|
client = make_client(tmp_path)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user