Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_get_water now returns cups instead of milliliters like the Doumentation says #112

Merged
merged 1 commit into from
Nov 30, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions myfitnesspal/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -642,10 +642,10 @@ def _get_water(self, date: datetime.date) -> float:
+ "?date={date}".format(date=date.strftime("%Y-%m-%d"))
)
value = result.json()["item"]["milliliters"]
cups = int(Volume(ml=value).us_cup)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why round this way? Why round at all? E.g. int(1.9) returns 1.

if not self.unit_aware:
return value

return Volume(ml=value)
return cups
return Volume(us_cup=cups)

def __str__(self) -> str:
return f"MyFitnessPal Client for {self.effective_username}"
Expand Down