Skip to content

Commit

Permalink
revert
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinebou12 authored Mar 5, 2024
1 parent a86c2e9 commit cbe9b5f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -840,14 +840,14 @@ async def get_specific_metric(self, metric_type: str, metric: str, user_id: Opti
elif metric_type == METRIC_TYPE_GIRTH:
if self._last_updated_girth is None or time.time() - self._last_updated_girth > self.refresh:
last_measurement = (
self.girth_info[0]
self.girth_info["girths"][0]
if self.girth_info
else None
)
return last_measurement.get(metric, None) if last_measurement else None
elif metric_type == METRIC_TYPE_GIRTH_GOAL:
last_goal = next(
(goal for goal in self.girth_goal if goal['girth_type'] == metric),
(goal for goal in self.girth_goal['girth_goals'] if goal['girth_type'] == metric),
None
)
if self._last_updated_girth_goal is None or time.time() - self._last_updated_girth_goal > self.refresh:
Expand Down
4 changes: 2 additions & 2 deletions custom_components/renpho/api_renpho.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,14 +537,14 @@ async def get_specific_metric(self, metric_type: str, metric: str, user_id: Opti
elif metric_type == METRIC_TYPE_GIRTH:
if self._last_updated_girth is None or time.time() - self._last_updated_girth > self.refresh:
last_measurement = (
self.girth_info[0]
self.girth_info["girths"][0]
if self.girth_info
else None
)
return last_measurement.get(metric, None) if last_measurement else None
elif metric_type == METRIC_TYPE_GIRTH_GOAL:
last_goal = next(
(goal for goal in self.girth_goal if goal['girth_type'] == metric),
(goal for goal in self.girth_goal['girth_goals'] if goal['girth_type'] == metric),
None
)
if self._last_updated_girth_goal is None or time.time() - self._last_updated_girth_goal > self.refresh:
Expand Down

0 comments on commit cbe9b5f

Please sign in to comment.