msupply-foundation / open-msupply

Open mSupply represents our most recent advancement in the Logistics Management Information System (LMIS), expanding on more than two decades of development inherited from the well-established legacy of the original mSupply.
https://msupply.foundation/open-msupply/
Other
20 stars 12 forks source link

Vaccination card transactions aren't rounding correctly #4916

Open lache-melvin opened 5 days ago

lache-melvin commented 5 days ago

What went wrong? 😲

For vaccines where doses per unit is more than one, after creating a few vaccination transactions, we end up with this:

Screenshot 2024-09-30 at 5 20 52 PM

Also, the batch select (in the vax card) is rounding the decimals, so if you end up with and almost-zero stock line, it shows there as 0. Doses should always be an integer, shouldn't need the rounding!

Image

Expected behaviour 🤔

Decimal reductions in stock from vaccinations add up to whole units. None of this 0.00000000000001 business.

How to Reproduce 🔨

Steps to reproduce the behaviour:

  1. Have a vaccine item with many doses per unit. Bonus points for something like 7 per unit 😱
  2. Give some vaccinations
  3. View stock levels

Your environment 🌱

lache-melvin commented 1 day ago

Expectation is that most of the time, either:

There may be times there is e.g. 6 doses per vial, but this is probably not too common that we need to worry about it, at least for now.

If it does happen, should be resolved via inventory adjustment, rather than any magic by us behind the scenes. Perhaps could implement a special kind of stocktake in future for this?

In the meantime, change vaccination modal UI to show <1 dose, and disable this line (as can't dispense less than a dose), to indicate to the user that inventory adjustment is required