coddingtonbear / python-myfitnesspal

Access your meal tracking data stored in MyFitnessPal programatically
MIT License
794 stars 136 forks source link

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

Closed acrose99 closed 2 years ago

acrose99 commented 3 years ago

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 commented 2 years ago

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?

hannahburkhardt commented 2 years ago

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 commented 2 years ago

[...] 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.