Skip to content

Commit

Permalink
Merge pull request #198 from PerfectFit-project/478-fix-high-intensit…
Browse files Browse the repository at this point in the history
…y-minutes

Add max value to intensity goal
  • Loading branch information
bscheltinga authored Nov 1, 2023
2 parents f857eb1 + 1553b71 commit e77f66a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion 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,7 +144,8 @@ 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'])

return intensity_minutes
return min(intensity_minutes, MAX_VALUE_INTENSITY_GOAL)


except ValueError:
logging.error(f"Error in returned value from sensors: '{res}'")
Expand Down

0 comments on commit e77f66a

Please sign in to comment.