medTimer icon indicating copy to clipboard operation
medTimer copied to clipboard

bad handling of the thousands

Open Pacidus opened this issue 7 months ago • 4 comments

When setting the quantities of meds lefts if the app above a thousand strange behaviour occurs :

To Reproduce Steps to reproduce the behaviour :

  1. Go to a med and try to add an amount of to something above 1000 (in any entries even tho I've only tested it with the overall stock and the recharge quantity)
  2. Left the page you will se the right amount of medication
  3. Go back to the menue to set the amount of medication left
  4. Still the right amount but with a space between the thousands and the rest
  5. Left
  6. Only the first digits (before the space) is left

You can reproduce a similar bug by setting the refill amount to something above the thousands and adding many times

Expected behavior The value should be kept

Additional context I didn't gave my ardware/software info for privacy, but I don't think is related. The bug is likely due to the way the app handle number format. For display it shows numbers with spacing between every thousands. But when returning on the menue the format is kept that way. Likely when the app store numbers it only keep the first integer separated with a space but its formatting make it add a space that, when it store the number for a second time break it to the first digit encountered.

Many way to solve the issue one of them could be to separate displayed numbers from stored ones.

Except this the app is great. 🥰

Pacidus avatar May 17 '25 08:05 Pacidus

Thanks for the bug report, I'll fix this.

Futsch1 avatar May 17 '25 14:05 Futsch1

I've updated my version of MedTimer and the bug persists.

I've looked at #645 and I've figured that your solutions is made to work with thousands separated by coma but actually certainly due to my locale the thousands separator is not a coma but a space.

So you'll probably need a more robust solution that will not depend on the local of the phone.

Edit : I've figured nothing I've just looked again and yep I've no idea what's going on. The only clue I could give is that when I manually remove the spaces it works. But I have to do it each time I edit the numbers.

Edit 2: I've double checked I have the version 1.17.2 and even with a brand new med the issue persist.

Pacidus avatar May 18 '25 20:05 Pacidus

I will look into this once more, can you tell me what locale you are using?

Edit: ah, found the issue - the regex I am using to find the number is to blame, this does not take spaces into account. I will fix this, but it will take a few days since I will not be able to work on the app in the next few days.

Futsch1 avatar May 18 '25 20:05 Futsch1

I have French locale, it's great if the issue as been found. I'll wait for the next update thanks for the response.

Pacidus avatar May 18 '25 20:05 Pacidus