Skip to content

Commit

Permalink
Fix values as nullable (#51)
Browse files Browse the repository at this point in the history
* Fix values as nullable

Some values can in fact be None in certain circumstances, like when changing from one watch to another

* make DailySleep.value optional

---------

Co-authored-by: Matin Tamizi <[email protected]>
  • Loading branch information
sdenel and matin authored Mar 17, 2024
1 parent 9b5dfd4 commit 7ba3ec6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions garth/stats/hrv.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ class HRVBaseline:
low_upper: int
balanced_low: int
balanced_upper: int
marker_value: float
marker_value: Optional[float]


@dataclass(frozen=True)
class DailyHRV:
calendar_date: date
weekly_avg: int
last_night_avg: int
last_night_5_min_high: int
weekly_avg: Optional[int]
last_night_avg: Optional[int]
last_night_5_min_high: Optional[int]
baseline: HRVBaseline
status: str
feedback_phrase: str
Expand Down
4 changes: 2 additions & 2 deletions garth/stats/sleep.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import ClassVar
from typing import ClassVar, Optional

from pydantic.dataclasses import dataclass

Expand All @@ -7,7 +7,7 @@

@dataclass(frozen=True)
class DailySleep(Stats):
value: int
value: Optional[int]

_path: ClassVar[
str
Expand Down

0 comments on commit 7ba3ec6

Please sign in to comment.