From 4b4f1a8f313eac4ecb788dea0fc5c84694f636eb Mon Sep 17 00:00:00 2001 From: "Joseph.Dundon" Date: Fri, 8 Nov 2024 09:08:54 +0000 Subject: [PATCH] PI-2575 nullable field fixes --- .../justice/digital/hmpps/messaging/CommonPlatformHearing.kt | 4 ++-- .../kotlin/uk/gov/justice/digital/hmpps/messaging/Handler.kt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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()) {