Skip to content

Commit

Permalink
refactor(workout_examples.py): update method calls to use class_histo…
Browse files Browse the repository at this point in the history
…ry_uuid instead of id for clarity

refactor(performance_summary_detail.py): rename id to class_history_uuid for better semantic meaning and consistency

refactor(performance_summary_list.py): rename id to class_history_uuid for improved clarity and consistency

fix(performance_summary_detail.py): exclude and hide ratable field due to inaccuracy in reflecting data from PerformanceSummaryEntry
  • Loading branch information
NodeJSmith committed Jan 22, 2025
1 parent e3cb63a commit e48b8b5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions examples/workout_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def main():

# you can get detailed information about a specific performance summary by calling `get_performance_summary`
# which takes a performance_summary_id as an argument
data = otf.get_performance_summary(data_list[0].id)
data = otf.get_performance_summary(data_list[0].class_history_uuid)
print(data.model_dump_json(indent=4))

"""
Expand Down Expand Up @@ -207,7 +207,7 @@ def main():
# telemetry is a detailed record of a specific workout - minute by minute, or more granular if desired
# this endpoint takes a class_history_uuid, as well as a number of max data points (default 120)

telemetry = otf.get_telemetry(performance_summary_id=data_list[1].id)
telemetry = otf.get_telemetry(performance_summary_id=data_list[1].class_history_uuid)
telemetry.telemetry = telemetry.telemetry[:2]
print(telemetry.model_dump_json(indent=4))

Expand Down
9 changes: 7 additions & 2 deletions src/otf_api/models/performance_summary_detail.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,16 @@ class Rower(BaseEquipment):


class PerformanceSummaryDetail(OtfItemBase):
id: str
class_history_uuid: str = Field(..., alias="id")
class_name: str | None = Field(None, alias=AliasPath("class", "name"))
class_starts_at: datetime | None = Field(None, alias=AliasPath("class", "starts_at_local"))

ratable: bool | None = None
ratable: bool | None = Field(
None,
exclude=True,
repr=False,
description="Seems to be inaccurate, not reflecting ratable from `PerformanceSummaryEntry`",
)
calories_burned: int | None = Field(None, alias=AliasPath("details", "calories_burned"))
splat_points: int | None = Field(None, alias=AliasPath("details", "splat_points"))
step_count: int | None = Field(None, alias=AliasPath("details", "step_count"))
Expand Down
2 changes: 1 addition & 1 deletion src/otf_api/models/performance_summary_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ClassRating(OtfItemBase):


class PerformanceSummaryEntry(OtfItemBase):
id: str = Field(..., alias="id")
class_history_uuid: str = Field(..., alias="id")
calories_burned: int | None = Field(None, alias=AliasPath("details", "calories_burned"))
splat_points: int | None = Field(None, alias=AliasPath("details", "splat_points"))
step_count: int | None = Field(None, alias=AliasPath("details", "step_count"))
Expand Down

0 comments on commit e48b8b5

Please sign in to comment.