Skip to content

Commit 020d9c1

Browse files
authored
Merge pull request #95 from marcelbarbulescu/feat_add_max_data_points_to_get_workouts
Feature/add max_data_points arg to get_workouts()
2 parents 349d69f + 5d2f6f3 commit 020d9c1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/otf_api/api/workouts/workout_api.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,13 +242,14 @@ def get_workout_from_booking(self, booking: str | models.BookingV2) -> models.Wo
242242
return workout
243243

244244
def get_workouts(
245-
self, start_date: date | str | None = None, end_date: date | str | None = None
245+
self, start_date: date | str | None = None, end_date: date | str | None = None, max_data_points: int = 150
246246
) -> list[models.Workout]:
247247
"""Get the member's workouts, using the new bookings endpoint and the performance summary endpoint.
248248
249249
Args:
250250
start_date (date | str | None): The start date for the workouts. If None, defaults to 30 days ago.
251251
end_date (date | str | None): The end date for the workouts. If None, defaults to today.
252+
max_data_points (int): The maximum number of data points to return for the telemetry. Default is 150.
252253
253254
Returns:
254255
list[Workout]: The member's workouts.
@@ -265,7 +266,7 @@ def get_workouts(
265266
bookings_dict = {b.workout.id: b for b in bookings if b.workout}
266267

267268
perf_summaries_dict = self.client.get_perf_summaries_threaded(list(bookings_dict.keys()))
268-
telemetry_dict = self.client.get_telemetry_threaded(list(perf_summaries_dict.keys()))
269+
telemetry_dict = self.client.get_telemetry_threaded(list(perf_summaries_dict.keys()), max_data_points)
269270
perf_summary_to_class_uuid_map = self.client.get_perf_summary_to_class_uuid_mapping()
270271

271272
workouts: list[models.Workout] = []

0 commit comments

Comments
 (0)