coddingtonbear / python-myfitnesspal

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

Fix to UK stone/pound measurements #30

Closed dtpxl closed 5 years ago

dtpxl commented 8 years ago

Hey there

Ignoring the fact that the UK stone/pound measurement is weird, they show up on the measurements page as (for example) '12 st 3 lbs'. _get_numeric() currently transforms this to '123.0'. This means there's no way to cleanly differentiate the two units without hacky logic in the client app (which gets particularly messy if a measurement is sub 10 stone.)

This is a quick and dirty stab at it, I put it in the call to _get_numeric() rather than _get_numeric() itself to reduce the risk of breaking any of the other callers.

coddingtonbear commented 8 years ago

Oh man; I'm not sure how to handle this yet. I hadn't even realized until reading this PR that MFP properly localized measurements like that. Let me do a little thinking.

coddingtonbear commented 5 years ago

Thanks for your original report so long ago, @dtpxl -- I've finally resolved this, albeit in a slightly different way. Have a look at https://github.com/coddingtonbear/python-myfitnesspal/commit/d539e19c58e3c5d7391462f3f7e5656554bf41e7 if you're super curious.

Cheers, and really sorry for the terrible delay on this one!

dtpxl commented 5 years ago

This is awesome, many thanks for that! And yeah that's much better than the quick hack I submitted. Cheers again!