Skip to content

Commit

Permalink
Add max value to intensity goal
Browse files Browse the repository at this point in the history
  • Loading branch information
bscheltinga committed Oct 30, 2023
1 parent 8ed42c5 commit b128db5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sensor_api/sensorapi/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
MAX_VALUE_STEP_GOAL = 10000
TOKEN_HEADER = 'X-PerfectFit-Auth-Token'
PA_LAPSE_MODERATION = 0.95
MAX_VALUE_INTENSITY_GOAL = 150


# functions for sensors data querying
Expand Down Expand Up @@ -143,6 +144,9 @@ def get_intensity_minutes_data(user_id: int,
for hour in res_json:
intensity_minutes += sum(val > HR_INTENSITY_THRESHOLD for val in hour['values'])

if intensity_minutes > MAX_VALUE_INTENSITY_GOAL:
return MAX_VALUE_INTENSITY_GOAL

return intensity_minutes

except ValueError:
Expand Down

0 comments on commit b128db5

Please sign in to comment.