Simplifies the progression model to a universal rep ladder: every exercise follows 6→8→10→12 reps at current weight, then +5 lbs and reset to 6. Replaces per-user wk1/wk4 rep and weight targets with a single starting_weight field. - Add Alembic migration to drop wk1_reps/wk4_reps/wk1_weight/wk4_weight, add starting_weight (migrated from wk1_weight) - Run Alembic migrations on app startup instead of create_all, with auto-detection and stamping for legacy databases - Include alembic/ and alembic.ini in Docker image - Rewrite progression_service.get_suggestion() with ladder logic: climb, hold, weight_increase, hold_at_top, deload - Replace wk1/wk4 grid in exercise cards with rep ladder progress bar - Add color-coded progression badges by type - Change weight log input from text to number with pre-filled suggestion - Normalize weight input in routes (0→BW, bare number→N lbs) - Remove schedule page (route, template, nav link, tests) - Simplify user_programs.yaml from 4 fields to 1 per exercise - Update all tests for new schema and progression logic Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
32 lines
1.1 KiB
Python
32 lines
1.1 KiB
Python
"""UserExerciseProgram model for per-user exercise programming.
|
|
|
|
Links a user to an exercise with a starting weight for the rep ladder.
|
|
"""
|
|
|
|
from datetime import datetime
|
|
from typing import Optional
|
|
|
|
from sqlmodel import Field, SQLModel
|
|
|
|
|
|
class UserExerciseProgram(SQLModel, table=True):
|
|
"""Per-user programming for a specific exercise.
|
|
|
|
Attributes:
|
|
id: Primary key, auto-incremented.
|
|
user_id: FK to users table.
|
|
exercise_id: FK to exercises table.
|
|
starting_weight: Starting weight (e.g., "30 lbs", "BW").
|
|
created_at: Timestamp when the record was created.
|
|
updated_at: Timestamp of the last update.
|
|
"""
|
|
|
|
__tablename__ = "user_exercise_programs"
|
|
|
|
id: Optional[int] = Field(default=None, primary_key=True)
|
|
user_id: int = Field(foreign_key="users.id", index=True)
|
|
exercise_id: int = Field(foreign_key="exercises.id", index=True)
|
|
starting_weight: str = Field(default="")
|
|
created_at: datetime = Field(default_factory=datetime.utcnow)
|
|
updated_at: datetime = Field(default_factory=datetime.utcnow)
|