Skip to content

LIMS-1447: Don't allow shipping of red samples#929

Merged
ndg63276 merged 3 commits intopre-release/2025-R3.1from
improvement/LIMS-1447/dont-allow-shipping-of-red-samples
May 27, 2025
Merged

LIMS-1447: Don't allow shipping of red samples#929
ndg63276 merged 3 commits intopre-release/2025-R3.1from
improvement/LIMS-1447/dont-allow-shipping-of-red-samples

Conversation

@ndg63276
Copy link
Collaborator

JIRA ticket: LIMS-1447

Summary:

Users should not be allowed to ship red samples/shipments through Synchweb. Also, red shipments should already have a red session scheduled (and the same for yellow).

Changes:

  • Disable the "Create Air Waybill" button if the shipment is rated red.
  • If a shipment is being created and is rated as not green, only show suitable sessions, also show a message if no sessions are found

To test:

  • Find a proposal with an upcoming yellow session, the calendar is good for this
  • Go to that proposal and start creating a shipment
  • Set the shipment as Green, you should be able to select any option for the "Scheduling" question. Choose "I have a session already scheduled", and check a dropdown appears showing all current and future visits
  • Change the shipment to Yellow, check the dropdown now only shows the upcoming yellow visit
  • Change the shipment to Red, check the dropdown disappears and a message says "(no suitable sessions found)"
  • Change the shipment back to green and finish making the shipment, no containers are necessary.
  • View the shipment, check the "Create Air Waybill" button is enabled
  • Change= the shipment to Red, refresh the page, check the "Create Air Waybill" button is now disabled, with a message at the top.

@gfrn
Copy link
Collaborator

gfrn commented May 9, 2025

I was able to create an airway bill for a red shipment

image

To reproduce:

  • Create a green shipment
  • Change the safety level to red
  • Click "create airway bill" without refreshing the page
  • Fill in the form
  • Create the airway bill

Maybe we also need a backend check to make sure that this can't happen?

@ndg63276
Copy link
Collaborator Author

I was able to create an airway bill for a red shipment

I've moved some of the logic out of the template file and into the JS file, so the page can now change as soon as the model changes. So hopefully that is no longer possible.

@gfrn gfrn self-requested a review May 13, 2025 09:13
@gfrn
Copy link
Collaborator

gfrn commented May 13, 2025

Should there be a check in place in the backend too?

I can still create a shipment by sending POST requests or manually navigating to https://local-oidc-test.diamond.ac.uk:8082/shipments/awb/sid/71136

@ndg63276
Copy link
Collaborator Author

It's hard to bloick on the backend as it may go to the shipping service, impossible to block everything anyway, so I've added a check on shipments/awb/sid/<shippingId> to prevent accidental use.

I've also put in some code to encourage users to declare a safety level if they haven't already (eg CSV uploads), by hiding some buttons (with a message to tell them what to do).

@ndg63276 ndg63276 changed the base branch from master to pre-release/2025-R3.1 May 27, 2025 09:32
@ndg63276 ndg63276 merged commit 68b17df into pre-release/2025-R3.1 May 27, 2025
2 checks passed
@ndg63276 ndg63276 deleted the improvement/LIMS-1447/dont-allow-shipping-of-red-samples branch May 27, 2025 09:33
ndg63276 added a commit that referenced this pull request Jun 10, 2025
* LIMS-1447: Don't allow shipping of red samples (#929)

* LIMS-1664: Improvements to registered dewar and container pages (#927)

* LIMS-1636: Make LDAP server ID field configurable (#934)

* LIMS-1699: Show confirmation dialog if a user creates a plate that is not full (#924)

* LIMS-1713: Allow sm beamlines to use mx Create Container page (#932)

* LIMS-1770: Fix download of attachments on saxs and xpdf beamlines (#944)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants