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

Map 1745 UOF bug users unable to access incident details page #743

Conversation

GurnankCheema
Copy link
Contributor

@GurnankCheema GurnankCheema commented Dec 10, 2024

MAP-1745

This code change fixes the scenario where the /incident-details page will not load if an offender is currently in a transfer or has left prison. This is signified by the offenders agencyId being TRN or OUT.
In such cases, loading of incident-details fails (and throws a 400 error) because TRN and OUT are not actual prisons and getting their internal locations, which are required by the select drop-down on the page, would return an error.

With the new code, when a user selects /incident-details, a check of the agencyId is done. If it's either TRN or OUT then we redirect to the change prison page. The /change-prison endpoint has been renamed to /prison-of-incident because the user's first action may not have been to change prison straight away but rather it's an action that's forced on them.

In the previous code, selecting the 'Change' link in /incident-details page saves any user input and calls draftReportService.process which either updates an existing report or creates a new one. This is triggered via frontend javascript that acts on components with the 'js-submitLink' html class. Because the frontend javascript trigger is now being circumvented by the immediate redirect to /prison-of-incident, the draftReportService.process is called in the submit of /prison-of-incident.

Have used flash to pass any user inputs to /prison-of-incident

Copy link

@BarryGee-MOJ BarryGee-MOJ left a comment

Choose a reason for hiding this comment

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

LGTM

@GurnankCheema GurnankCheema merged commit b5a2cac into main Dec 10, 2024
9 checks passed
@GurnankCheema GurnankCheema deleted the MAP-1745-UoF-bug-users-unable-to-access-incident-details-page branch December 10, 2024 11:28
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