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

Refactor placement-request page information #2280

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gregkhawkins
Copy link
Contributor

Context

  • Related JIRA: https://dsdmoj.atlassian.net/browse/APS-1693
  • This PR makes changes to the Summary information on the Placement request page in the Find and Book flow. This includes removing the data that overlaps with thre blue banner and moving the rest of the data to a summary list.

Changes in this PR

Screenshots of UI changes

Before

placement_request_before

After

placement_request_after

})
export const licenceExpiryDateRow = (placementRequest: PlacementRequestDetail) => {
let licenceExpiryDate: string | undefined
if (placementRequest.application && 'licenceExpiryDate' in placementRequest.application) {
Copy link
Contributor Author

@gregkhawkins gregkhawkins Jan 10, 2025

Choose a reason for hiding this comment

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

the integration tests saved my neck here as the isParole test case does not have an application associated with the placementRequest (in the test data setup). I assume that the data setup in that test reflects reality. Anyway, this means we need the if (placementRequest.application) check for sure or a runtime exception would occur for the isParole scenario.
I also added the if ('licenceExpiryDate' in placementRequest.application) check as I was growing increasingly paranoid that a placementRequest.application would not be of type ApprovedPremisesApplication. I did check this in the backend previously (when Bob flagged it on previous PR) and it seemed for the occupancy-view page it always would be, however with recent work on offline applications etc I wondered whether we could end up with an application that does not meet this type leading to a runtime exception related to that when we try to access the licenseExpiryDate field (specific to ApprovedPremisesApplication only).
Let me know if this is too defensive or if you can think of a more graceful way to do it

).toEqual(expectedMatchingDetailsSummaryListItems(''))
})

it(`should generate the expected matching details when placement-request's application is not of type ApprovedPremisesApplication`, () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

justification for this test case is in a comment in the index.ts file of this PR

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.

1 participant