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

6144 add check for exceeding max orders #6211

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from

Conversation

fergie-nz
Copy link
Contributor

Fixes #6144

πŸ‘©πŸ»β€πŸ’» What does this PR do?

Adds back end check to ensure we don't create program requisitions when the maximum number for that period has been reached.

Also adds front end error handling when attempting to create more than the specified number of

πŸ’Œ Any notes for the reviewer?

I think we should spend time adding back end tests to creating program requisitions. Right now there is quite complicated logic with no tests validating.

Any fixes such as this one are time consuming to deal with. It is also currently unclear if there are other gaps in the logic without tests.

πŸ§ͺ Testing

The way to test this using in app behaviour is to attempt to create duplicate requisitions which combined would exceed the maximum number together.
This requires 2 browsers:

  • Create a program active on a site with an order type of maximum orders of 1
  • Log in to OMS on two separate browsers
  • Open the UI to create a requisition of this order type for a given period
  • Create 2 requisitions at the same time from the 2 different browsers
  • See error prompt

πŸ“ƒ Documentation

  • No documentation required: no user facing changes or a bug fix which isn't a change in behaviour

@github-actions github-actions bot added this to the V2.5.0-RC6 milestone Jan 21, 2025
@github-actions github-actions bot added bug Something is borken Team Ruru πŸ¦‰ Roxy, Ferg, Noel Severity: Hotfix Extreme user impact. Can't finalise invoices. Needs patch release and installation immediately. labels Jan 21, 2025
Copy link

github-actions bot commented Jan 21, 2025

Bundle size difference

Comparing this PR to main

Old size New size Diff
5.21 MB 5.21 MB 1.63 KB (0.03%)

Copy link
Contributor

@roxy-dao roxy-dao left a comment

Choose a reason for hiding this comment

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

Thanks for the changes Ferg. I've given it a quick whirl. Don't wanna comment on code yet until this is fixed..

As you can see my max orders for this order type is 2~ but I have managed to make 4 orders for this order type both through having two instances opened + directly calling endpoint 😭
Screenshot 2025-01-22 at 12 13 32β€―PM

Screenshot 2025-01-22 at 12 10 41β€―PM

@roxy-dao roxy-dao modified the milestones: V2.5.0-RC7, v2.6.0 Jan 22, 2025
@roxy-dao roxy-dao changed the base branch from V2.5.0-RC to develop January 22, 2025 19:14
@fergie-nz
Copy link
Contributor Author

Thanks for the changes Ferg. I've given it a quick whirl. Don't wanna comment on code yet until this is fixed..

As you can see my max orders for this order type is 2~ but I have managed to make 4 orders for this order type both through having two instances opened + directly calling endpoint 😭 Screenshot 2025-01-22 at 12 13 32β€―PM

Screenshot 2025-01-22 at 12 10 41β€―PM

Oh no! Thanks Roxy,

I saw a gap in the logic where you would be able to create one more when existing = max, but not 4.

I'm getting this error response when I try to create more. Are you still able to recreate making many more than max?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is borken Severity: Hotfix Extreme user impact. Can't finalise invoices. Needs patch release and installation immediately. Team Ruru πŸ¦‰ Roxy, Ferg, Noel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

You can create more than the max number of emergency internal orders by period defined for a program.
2 participants