diff --git a/projects/common-platform-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/messaging/CommonPlatformHearing.kt b/projects/common-platform-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/messaging/CommonPlatformHearing.kt index 6e4ee0a2b0..2573adcc63 100644 --- a/projects/common-platform-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/messaging/CommonPlatformHearing.kt +++ b/projects/common-platform-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/messaging/CommonPlatformHearing.kt @@ -47,13 +47,13 @@ data class Defendant( data class Offence( val id: String, - val offenceDefinitionId: String, + val offenceDefinitionId: String? = null, val offenceCode: String, val offenceTitle: String, val wording: String, val offenceLegislation: String, val listingNumber: Int, - val judicialResults: List, + val judicialResults: List? = emptyList(), val plea: Plea? = null, val verdict: Verdict? = null ) diff --git a/projects/common-platform-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/messaging/Handler.kt b/projects/common-platform-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/messaging/Handler.kt index e2f070b59d..06d2a53e3f 100644 --- a/projects/common-platform-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/messaging/Handler.kt +++ b/projects/common-platform-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/messaging/Handler.kt @@ -32,9 +32,9 @@ class Handler( .flatMap { it.defendants } .filter { defendant -> defendant.offences.any { offence -> - offence.judicialResults.any { judicialResult -> + offence.judicialResults?.any { judicialResult -> judicialResult.isConvictedResult == true && judicialResult.label == "Remanded in custody" - } + } ?: false } } if (defendants.isEmpty()) {