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

Adjust1-101 view tagged bail adjustment #150

Merged
merged 10 commits into from
Feb 8, 2024

Conversation

pavilionsahota
Copy link
Contributor

No description provided.

@pavilionsahota pavilionsahota requested a review from a team as a code owner February 7, 2024 16:36
Copy link
Contributor

@ldlharper ldlharper left a comment

Choose a reason for hiding this comment

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

A few fairly minor comments. Looks really good though.

@@ -215,7 +215,7 @@ export interface components {
*/
prisonId?: string
/**
* @description The name name of the prison where the prisoner was located at the time the adjustment was created
* @description The name of the prison where the prisoner was located at the time the adjustment was created
Copy link
Contributor

Choose a reason for hiding this comment

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

These files are generated by the scripts in /scripts. The scripts generate these files from the backend API docs.

Not a big deal, just an FYI.

https://github.com/ministryofjustice/hmpps-adjustments-api/blob/main/src/main/kotlin/uk/gov/justice/digital/hmpps/adjustments/api/model/AdjustmentDto.kt#L39

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've undone that comment change and have adjusted the comment in the Dto instead 👍

}

private getCourtName(caseSequence: number): string {
const sentenceAndOffence = this.sentencesAndOffences.find(it => it.caseSequence === caseSequence)
Copy link
Contributor

Choose a reason for hiding this comment

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

So there can be multiple sentences on the same court case (Will have the same case sequence).

Have a look at how we select the sentence by sentence date in the add journey.
https://github.com/ministryofjustice/hmpps-adjustments/blob/main/server/model/taggedBailSelectCaseModel.ts#L32

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've moved some logic out of the taggedBailSelectCaseModel.ts into the utils.ts so that they can be used by the taggedBailViewModel.ts too. This way they're both using the same logic 👍

const prisonerDetail = await this.prisonerService.getPrisonerDetail(nomsId, caseloads, token)
const adjustments = await this.adjustmentsService.findByPerson(nomsId, token)
const taggedBailAdjustments = adjustments.filter(it => it.adjustmentType === 'TAGGED_BAIL')
if (!taggedBailAdjustments) {
Copy link
Contributor

Choose a reason for hiding this comment

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

!taggedBailAdjustments.length

If there are no tagged bail adjustments the filter will return an empty array which is truthy

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've corrected this in the way you have suggested 👍

return res.redirect(`/${nomsId}`)
}

const sentencesAndOffences = await this.prisonerService.getSentencesAndOffencesFilteredForRemand(
Copy link
Contributor

Choose a reason for hiding this comment

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

use getSentencesAndOffences over getSentencesAndOffencesFilteredForRemand.

The function you use filters out sentences that aren't applicable for remand (unrelated to tagged bail.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've changed this method call in the way you have suggested 👍

Copy link
Contributor

@ldlharper ldlharper left a comment

Choose a reason for hiding this comment

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

LGTM

@pavilionsahota pavilionsahota merged commit 63b17cf into main Feb 8, 2024
4 checks passed
@pavilionsahota pavilionsahota deleted the ADJUST1-101-view-tagged-bail-adjustment branch February 8, 2024 13:39
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