HRV baseline band from Garmin + dashboard HRV colours + route name on recent activities + sync-now race fix
This commit is contained in:
@@ -125,6 +125,16 @@ class Activity(Base):
|
||||
named_route = relationship("NamedRoute", back_populates="activities")
|
||||
laps = relationship("ActivityLap", back_populates="activity", cascade="all, delete-orphan")
|
||||
|
||||
@property
|
||||
def named_route_name(self):
|
||||
"""Name of the associated NamedRoute, or None. Reads the relationship only
|
||||
if it was eager-loaded (selectinload) so it never triggers a lazy load in
|
||||
the async request context — returns None when unloaded."""
|
||||
from sqlalchemy import inspect as sa_inspect
|
||||
if "named_route" in sa_inspect(self).unloaded:
|
||||
return None
|
||||
return self.named_route.name if self.named_route else None
|
||||
|
||||
|
||||
class ActivityDataPoint(Base):
|
||||
__tablename__ = "activity_data_points"
|
||||
@@ -254,6 +264,8 @@ class HealthMetric(Base):
|
||||
hrv_nightly_avg = Column(Float, nullable=True)
|
||||
hrv_5min_high = Column(Float, nullable=True)
|
||||
hrv_5min_low = Column(Float, nullable=True)
|
||||
hrv_baseline_low = Column(Float, nullable=True) # Garmin balanced range lower bound (balancedLow)
|
||||
hrv_baseline_upper = Column(Float, nullable=True) # Garmin balanced range upper bound (balancedUpper)
|
||||
sleep_duration_s = Column(Float, nullable=True)
|
||||
sleep_deep_s = Column(Float, nullable=True)
|
||||
sleep_light_s = Column(Float, nullable=True)
|
||||
|
||||
Reference in New Issue
Block a user