fix(FI0-11277): NMD departure vs arrival fishery weight validation#188
Open
salfedev wants to merge 2 commits into
Open
fix(FI0-11277): NMD departure vs arrival fishery weight validation#188salfedev wants to merge 2 commits into
salfedev wants to merge 2 commits into
Conversation
…r NMD - Add checkNetWeightFisheryProductDepartureExceedsArrival (Scenario 5) to storage-notes handler; called on /departure-product-summary - Call the new check in progress.service catchesHaveValidDepartureWeights so the departure section is marked incomplete when invalid - Re-run all departure vs arrival weight checks in checkValidationStorageNotes at submission time to block NMD submit when arrival weights were edited after departure weights were confirmed
…rs to shared module Move the three departure vs arrival weight comparison functions out of storage-notes.ts into a new src/validators/storageWeightValidator.ts. storage-notes.ts already imports utility helpers from orchestration.service; importing storage-notes in orchestration.service created a cycle. The new shared module has no dependencies on either file. - storage-notes.ts: import + re-export from storageWeightValidator - orchestration.service.ts: import from storageWeightValidator (not storage-notes) - progress.service.ts: import three comparison fns from storageWeightValidator Also adds isolated progress service test for Scenario 5 (fishery departure exceeds fishery arrival but product departure is valid).
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
Summary
Fixes FI0-11277 (Defect 593 UAT) — NMD departure and arrival weights validation was missing the check that fishery product departure weight ≤ fishery product arrival weight. This allowed users to submit an NMD with a fishery departure weight greater than its fishery arrival weight.
There was also no re-validation of departure vs arrival weight relationships at submission time, meaning a user who edited arrival weights after confirming departure weights could submit an NMD with stale/invalid weight data.
Changes
src/services/handlers/storage-notes.tscheckNetWeightFisheryProductDepartureExceedsArrival(Scenario 5): blocks submission of the departure-product-summary page when fishery product departure weight exceeds fishery product arrival weight./create-non-manipulation-document/:documentNumber/departure-product-summaryhandler alongside the existing checks.src/services/progress.service.tscheckNetWeightFisheryProductDepartureExceedsArrivalincatchesHaveValidDepartureWeightsso the departure section shows asINCOMPLETEif the fishery arrival invariant is violated.src/services/orchestration.service.tscheckValidationStorageNotes(submission endpoint) to re-run all departure vs arrival weight checks at submit time —sdNetWeightProductDepartureExceedsArrival,sdNetWeightFisheryProductDepartureExceedsArrival, andsdNetWeightFisheryProductDepartureExceedsProductDeparture— pushing failures intovalidationErrorsto block document submission.Tests
storage-notes.jest.spec.tscovering Scenario 5 (error case and no-error case).orchestration.service.jest.spec.tscovering submission-time weight validation (departure > arrival, fishery departure > fishery arrival, valid case).Fixes - Jira Link #
Ticket
FI0-11277
Type of change
Please tick the relevant option for your PR request. Follow Semantic Version: v
MAJOR.MINOR.PATCHChecklist: