Skip to content

Commit

Permalink
CVSL-2292 obtain activeOffenderManager and destructure out descriptio…
Browse files Browse the repository at this point in the history
…n value
  • Loading branch information
louisenorris committed Jan 21, 2025
1 parent 7918163 commit 457383a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion server/services/licenceSearchService.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,15 @@ module.exports = function createLicenceSearchService(
if (!prisoner) return []
const probationDetail = probationDetails.find((pd) => pd.otherIds.nomsNumber === prisoner.prisonerNumber)
if (!probationDetail) return []
const activeOffenderManager = probationDetail.offenderManagers.find((om) => om.active)
const { description } = activeOffenderManager.probationArea
return [
{
prisonerNumber: prisoner.prisonerNumber,
prisonerFirstname: prisoner.firstName,
prisonLastname: prisoner.lastName,
HDCED: moment(prisoner.homeDetentionCurfewEligibilityDate).format('DD-MM-YYYY'),
PDU: probationDetail ? probationDetail.offenderManagers[0].probationArea.description : '',
PDU: description || '',
},
]
})
Expand Down

0 comments on commit 457383a

Please sign in to comment.