Skip to content

Commit

Permalink
testing
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinebou12 authored Mar 6, 2024
1 parent 5083e94 commit d781559
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -840,22 +840,16 @@ async def get_specific_metric(self, metric_type: str, metric: str, user_id: Opti
return self.weight_info.get(metric, None) if self.weight_info else None
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]
if self.girth_info
else None
)
return last_measurement.get(metric, None) if last_measurement else None
return self.girth_info[0].get(metric, None) if self.girth_info else None
await self.list_girth()
for girth_entry in self.girth_info:
if hasattr(girth_entry, f"{metric}_value"):
return getattr(girth_entry, f"{metric}_value", None)
elif metric_type == METRIC_TYPE_GIRTH_GOAL:
last_goal = next(
(goal for goal in self.girth_goal if goal.girth_type == metric),
None
)
if self._last_updated_girth_goal is None or time.time() - self._last_updated_girth_goal > self.refresh:
return last_goal.get('goal_value', None)
else:
return last_goal.get('goal_value', None)
await self.list_girth_goal()
for goal in self.girth_goal:
if goal.girth_type == metric:
return goal.goal_value
elif metric_type == METRIC_TYPE_GROWTH_RECORD:
if self._last_updated_growth_record is None or time.time() - self._last_updated_growth_record > self.refresh:
last_measurement = (
Expand Down

0 comments on commit d781559

Please sign in to comment.