40 lines
1.5 KiB
Python
40 lines
1.5 KiB
Python
"""ProgressLog model for tracking progression suggestions and outcomes.
|
|
|
|
Records what the progression engine suggested vs what the user actually did.
|
|
"""
|
|
|
|
import datetime as dt
|
|
from typing import Optional
|
|
|
|
from sqlmodel import Field, SQLModel
|
|
|
|
|
|
class ProgressLog(SQLModel, table=True):
|
|
"""A progression tracking entry for a specific exercise.
|
|
|
|
Attributes:
|
|
id: Primary key, auto-incremented.
|
|
user_id: FK to users table.
|
|
exercise_id: FK to exercises table.
|
|
date: The date this progression entry applies to.
|
|
suggested_reps: What the engine recommended.
|
|
suggested_weight: What the engine recommended.
|
|
actual_reps: What the user actually did.
|
|
actual_weight: What the user actually used.
|
|
progression_applied: Type of progression (e.g., "reps_increase", "weight_increase", "deload").
|
|
created_at: Timestamp when the record was created.
|
|
"""
|
|
|
|
__tablename__ = "progress_log"
|
|
|
|
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")
|
|
date: dt.date = Field(default_factory=dt.date.today)
|
|
suggested_reps: Optional[int] = Field(default=None)
|
|
suggested_weight: Optional[str] = Field(default=None)
|
|
actual_reps: Optional[int] = Field(default=None)
|
|
actual_weight: Optional[str] = Field(default=None)
|
|
progression_applied: Optional[str] = Field(default=None)
|
|
created_at: dt.datetime = Field(default_factory=dt.datetime.utcnow)
|