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

Conversation

acrose99
Copy link
Contributor

@acrose99 acrose99 commented Nov 20, 2020

On the readMe documentation for getting your cups of water it says

Or, if you just want to see how many cups of water you've recorded, or the notes you've entered for a day:

day.water
# >> 1
day.notes
# >> "This is the note I entered for this day"

However, as it stands, _get_water in the client returns the millimeters of recorded, not the cups.

day.water
# >> 480 (2 cups recorded)

Therefore I would either update the readMe or change the client code like I've done in this pull request!

New readMe:

Or, if you just want to see how many millimeters of water you've recorded, or the notes you've entered for a day:

day.water
# >> 240.0
day.notes
# >> "This is the note I entered for this day"

Obviously the readMe change is easy, but let me know if my code isn't good enough and I can try again. Thanks!!

@coddingtonbear
Copy link
Owner

I'm a little suspicious that this might be due to measurement settings set in the MFP UI, and that we might instead need to either update the docs to make this ambiguous, or somehow look up the unit used in the user's settings. I unfortunately don't use this particular feature, so I can't say for sure offhand -- do any of you all who use this have any insight?

@@ -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.

@hannahburkhardt
Copy link
Collaborator

I'm a little suspicious that this might be due to measurement settings set in the MFP UI, and that we might instead need to either update the docs to make this ambiguous, or somehow look up the unit used in the user's settings. I unfortunately don't use this particular feature, so I can't say for sure offhand -- do any of you all who use this have any insight?

It seems to always come back as milliliters regardless of user unit preference. Either way, we are reading the "milliliters" node of the json response, so it's probably safe to assume that this will be in milliliters.

@coddingtonbear
Copy link
Owner

[...] Either way, we are reading the "milliliters" node of the json response, so it's probably safe to assume that this will be in milliliters.

That... is an excellent point! I'm convinced.

@coddingtonbear coddingtonbear changed the base branch from master to 112__get_water_returns_ml November 30, 2021 14:55
@coddingtonbear coddingtonbear merged commit b066263 into coddingtonbear:112__get_water_returns_ml Nov 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants