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

Add safety around dose setting on an item batch #3953

Merged

Conversation

josh-griffin
Copy link
Contributor

Fixes #3948

Change summary

  • I could recreate some variant of the bug by adding some quantity of an item with 12 doses / vial then dispensed all except for the last quantity. Then I dispensed the very last dose to a patient, and that patient got an extra line with some very tiny amount which seems to be just some 'leftover' quantity from adding/subtracting n stuff.
  • So, made the assumption that 1 dose is the absolute minimum quantity an item batch should have (greater than zero) and after having set the quantity of the item batch, if there is still some tiny amount left that is less then one dose, just set it to zero.
  • The assumption doesn't work if the doses per vial <1

Testing

  • Have 1 vaccine with 12 doses/vial. Give yourself some quantity. Then, dispense all. On the very LAST dose when dispensing through vaccine dispensing, the patient is only given 1 LINE in the transaction, and the ITEM BATCH now has ZERO quantity.

Related areas to think about

N/A

Base automatically changed from #3859-form-reducer-crash to #3939-can-refuse-and-bonus-dose April 17, 2021 05:25
Base automatically changed from #3939-can-refuse-and-bonus-dose to #3938-patient-history April 17, 2021 05:25
Base automatically changed from #3938-patient-history to release/v8.0.2 April 17, 2021 05:40
Copy link
Contributor

@mark-prins mark-prins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow! impressed you managed to recreate in some fashion

@mark-prins
Copy link
Contributor

I tested with a doses value of 6 because I'm lazy. With that I didn't get an auto-added extra trans line, but I was able to dispense a 7th dose out of my vial when the quantity showed as 0:

Screen Shot 2021-04-18 at 11 20 33 AM

And the resulting transaction had a very small quantity value.
This PR fixed that issue too

@josh-griffin josh-griffin merged commit 6422cb7 into release/v8.0.2 Apr 19, 2021
@josh-griffin josh-griffin deleted the #3948-patients-allocated-incorrect-dose branch April 19, 2021 02:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants