Skip to content

Commit

Permalink
PI-2482 Handle null offences in assessment summary response (#4203)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-bcl authored Aug 28, 2024
1 parent df98c65 commit 1a4b585
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ data class AssessmentSummary(
val weightedScores: WeightedScores = WeightedScores(),
val furtherInformation: FurtherInformation = FurtherInformation(),
val ogpOvp: OgpOvp = OgpOvp(),
val offences: List<Offence> = arrayListOf(),
val offences: List<Offence>? = arrayListOf(),
val basicSentencePlan: List<BasicSentencePlanArea>? = null,
val sentencePlan: SentencePlan? = null
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ class AssessmentService(
contact = contact,
court = furtherInformation.courtCode
?.let { courtRepository.getByCode(it) },
offence = offences.firstOrNull { it.offenceCode != null && it.offenceSubcode != null }
offence = offences
?.firstOrNull { it.offenceCode != null && it.offenceSubcode != null }
?.let { offenceRepository.findByCode(it.offenceCode + it.offenceSubcode) },
totalScore = furtherInformation.totWeightedScore,
description = furtherInformation.pOAssessmentDesc,
Expand Down

0 comments on commit 1a4b585

Please sign in to comment.