jfoucry / Pilldroid

Gestion théorique de stock de médicament
Other
3 stars 2 forks source link

Crash when entering float value for threshold #54

Open Altonss opened 2 months ago

Altonss commented 2 months ago
java.lang.NumberFormatException: For input string: "3.0001"
    at java.lang.Integer.parseInt(Integer.java:747)
    at java.lang.Integer.parseInt(Integer.java:865)
    at net.foucry.pilldroid.DrugDetailActivity.Q(Unknown Source:127)
    at net.foucry.pilldroid.DrugDetailActivity.O(Unknown Source:0)
    at net.foucry.pilldroid.DrugDetailActivity$a.onClick(Unknown Source:5)
    at android.view.View.performClick(View.java:7542)
    at android.view.View.performClickInternal(View.java:7519)
    at android.view.View.-$$Nest$mperformClickInternal(Unknown Source:0)
    at android.view.View$PerformClick.run(View.java:29476)
    at android.os.Handler.handleCallback(Handler.java:942)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:201)
    at android.os.Looper.loop(Looper.java:288)
    at android.app.ActivityThread.main(ActivityThread.java:7940)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    at com.android.internal.os.ExecInit.main(ExecInit.java:49)
    at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
    at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:355)
jfoucry commented 2 months ago

As IIRC, those field are not made for having float values. Did you think it will be a good idea to permit floating values? I can't imagine a use case. Feel free to update your issue with use case. Thanks

Jean-BaptisteC commented 2 months ago

It's possible to constraint fields to fill only with number without comma.

Altonss commented 2 months ago

As IIRC, those field are not made for having float values. Did you think it will be a good idea to permit floating values? I can't imagine a use case. Feel free to update your issue with use case. Thanks

I have no strong opinion about it, but this should be better handled by the software, not by the end-user I think :) Either only allowing integers or handling floats ^^

But in case a user takes always 0,5 a day, 1,5 as a threshold (corresponding to 3 days) isn't completely absurd IMHO :)

jfoucry commented 2 months ago

Ok, first test with threshold fields without coma and we will see :-)