mirror of
https://github.com/joaovitoriasilva/endurain.git
synced 2026-01-07 23:13:57 -05:00
fix: break long line to comply with PEP8 79 char limit
This commit is contained in:
@@ -369,7 +369,7 @@ def transform_activity_streams_hr(activity_stream, activity, db):
|
||||
activity: The activity object associated with the stream, used to retrieve the user ID.
|
||||
db: The database session or connection used to fetch user details.
|
||||
Returns:
|
||||
The activity stream object with an added 'hr_zone_percentages' attribute, which contains the percentage of time spent in each heart rate zone and their respective HR boundaries. If waypoints or user details are missing, returns the original activity stream unchanged.
|
||||
The activity stream object with an added 'hr_zone_percentages' attribute, which contains the percentage of time spent in each heart rate zone and their respective HR boundaries. If waypoi[...]
|
||||
Notes:
|
||||
- Heart rate zones are calculated using the formula: max_heart_rate = 220 - age.
|
||||
- The function expects waypoints to be a list of dicts with an "hr" key.
|
||||
@@ -429,7 +429,11 @@ def transform_activity_streams_hr(activity_stream, activity, db):
|
||||
|
||||
# Calculate time in seconds for each zone using the percentage
|
||||
# of total_timer_time
|
||||
if hasattr(activity, "total_timer_time") and activity.total_timer_time:
|
||||
has_timer_time = (
|
||||
hasattr(activity, "total_timer_time")
|
||||
and activity.total_timer_time
|
||||
)
|
||||
if has_timer_time:
|
||||
total_time_seconds = activity.total_timer_time
|
||||
zone_time_seconds = [
|
||||
int((percent / 100) * total_time_seconds)
|
||||
|
||||
Reference in New Issue
Block a user