Skip to content

Commit

Permalink
Round mmol/L SGV to 1 decimal point
Browse files Browse the repository at this point in the history
  • Loading branch information
marciogranzotto committed Nov 1, 2021
1 parent d487a12 commit 4e4605b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion py_nightscout/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def json_transforms(cls, json_data):
json_data["date"] = dateutil.parser.parse(json_data["dateString"])

def mgdlTommolL(self, mgdl):
return mgdl / 18
return round(mgdl / 18, 1)


class Treatment(BaseModel):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ async def test_get_sgv(api: nightscout.Api):
entries = await api.get_sgvs()
assert 10 == len(entries)
assert 169 == entries[0].sgv
assert 9.38888888888889 == entries[0].sgv_mmol
assert 9.4 == entries[0].sgv_mmol
assert "FortyFiveDown" == entries[0].direction
assert -5.257 == entries[0].delta
assert datetime(2020, 8, 5, 19, 1, 6, 533000, tzinfo=tzutc()) == entries[0].date
Expand Down

0 comments on commit 4e4605b

Please sign in to comment.