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

False interpretation of decimal #61

Open
YPOC opened this issue May 24, 2017 · 6 comments
Open

False interpretation of decimal #61

YPOC opened this issue May 24, 2017 · 6 comments
Labels

Comments

@YPOC
Copy link

YPOC commented May 24, 2017

When entering carbs or insulin shots with decimal places the decimal point gets omitted, so inputting 0.55 results in 55.0. The same goes for entering the basal profile.
I'm using Happ on an Android 7.0.1 phone with the system language set to German, where the default decimal sign is , (comma). It would be nice if it was possible to enter values with either decimal point or decimal comma, currently I have to press the dot for a decimal sign to appear in the input field.

@timomer
Copy link
Owner

timomer commented Jun 9, 2017

Hey, sorry for such a delay in responding.

I think this maybe the string to decimal function cleaning "0,55" to 055.

Can you confirm that if you enter "0.55" (dot, not comma) works correctly?

@timomer timomer added the bug label Jun 9, 2017
@YPOC
Copy link
Author

YPOC commented Jun 9, 2017

First I tried only replacing the decimal places, leaving the dot in place, but 0.55 became 55. Then I tried using the dot as decimal point, but 0.55 still became 55.
When I press the comma on my keyboard nothing gets inserted.

@timomer
Copy link
Owner

timomer commented Jun 9, 2017 via email

@YPOC
Copy link
Author

YPOC commented Jun 9, 2017

1.55 becomes 155 as well.

@timomer
Copy link
Owner

timomer commented Jun 9, 2017 via email

@timomer
Copy link
Owner

timomer commented Jun 12, 2017

Hey @YPOC , please test the following apk.
https://drive.google.com/file/d/0BxE8lMx4AjLiNmdieGxmbC1HLU0/view?usp=sharing

So the issue was in two places, first, the edit text box was limited so that only decimal numbers with a "." can be used. Second, the function that converts a Sting to Double correctly detected you are DE, found a string with a dot "0.55", as this is incorrect for DE as it expected a "," it removes the dot "055".

One option to fix this is to allow the edit text box to enter any number with "," or "." and allow the Sting to Double function to clean it up, but, this could result in an input of a DE user entering "0.55" and it being converted to "055", but "0,55" would work correctly.

I do not like this as it means we have to be sure for locations that use "," as a decimal separator that they never use "."

A better approach is to keep the input fields locked to decimal with "." - this means I can control the user input (even if they don't like it!) and correct the Sting to Double function to never expect ","

Please test and let me know your thoughts?

(Looks like I have already fixed this in Dev and may not have pushed it to master)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants