diff --git a/projects/effective-proposal-framework-and-delius/src/integrationTest/kotlin/uk/gov/justice/digital/hmpps/IntegrationTest.kt b/projects/effective-proposal-framework-and-delius/src/integrationTest/kotlin/uk/gov/justice/digital/hmpps/IntegrationTest.kt index e7fc618853..67ffed6fc2 100644 --- a/projects/effective-proposal-framework-and-delius/src/integrationTest/kotlin/uk/gov/justice/digital/hmpps/IntegrationTest.kt +++ b/projects/effective-proposal-framework-and-delius/src/integrationTest/kotlin/uk/gov/justice/digital/hmpps/IntegrationTest.kt @@ -66,8 +66,11 @@ internal class IntegrationTest { Name(person.forename, person.secondName, person.surname), person.dateOfBirth, person.gender.description, + Conviction( + SentenceGenerator.RELEASED_EVENT.convictionDate!!, + Court(SentenceGenerator.DEFAULT_COURT.name) + ), Sentence( - SentenceGenerator.RELEASED_EVENT.convictionDate, SentenceGenerator.RELEASED_SENTENCE.date, Court(SentenceGenerator.DEFAULT_COURT.name), SentenceGenerator.RELEASE.date @@ -89,8 +92,8 @@ internal class IntegrationTest { ), PersonGenerator.DEFAULT.dateOfBirth, PersonGenerator.DEFAULT.gender.description, + Conviction(SentenceGenerator.DEFAULT_EVENT.convictionDate!!, Court(SentenceGenerator.DEFAULT_COURT.name)), Sentence( - SentenceGenerator.DEFAULT_EVENT.convictionDate, SentenceGenerator.DEFAULT_SENTENCE.date, Court(SentenceGenerator.DEFAULT_COURT.name), null diff --git a/projects/effective-proposal-framework-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/epf/CaseDetails.kt b/projects/effective-proposal-framework-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/epf/CaseDetails.kt index d90027ce90..535c2d4605 100644 --- a/projects/effective-proposal-framework-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/epf/CaseDetails.kt +++ b/projects/effective-proposal-framework-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/epf/CaseDetails.kt @@ -9,6 +9,7 @@ data class CaseDetails( val name: Name, val dateOfBirth: LocalDate, val gender: String, + val conviction: Conviction?, val sentence: Sentence?, val responsibleProvider: Provider?, val ogrsScore: Long? @@ -21,9 +22,13 @@ data class CaseDetails( } data class Name(val forename: String, val middleName: String?, val surname: String) +data class Conviction( + val date: LocalDate, + val court: Court, +) + data class Sentence( - val convictionDate: LocalDate?, - val sentenceDate: LocalDate?, + val date: LocalDate, val sentencingCourt: Court, val releaseDate: LocalDate? ) diff --git a/projects/effective-proposal-framework-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/epf/CaseDetailsService.kt b/projects/effective-proposal-framework-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/epf/CaseDetailsService.kt index ad93a7a85f..8258cea766 100644 --- a/projects/effective-proposal-framework-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/epf/CaseDetailsService.kt +++ b/projects/effective-proposal-framework-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/epf/CaseDetailsService.kt @@ -24,12 +24,16 @@ class CaseDetailsService( person.name(), person.dateOfBirth, person.gender.description, - Sentence( - event.convictionDate, - event.disposal?.date, - Court(courtName), - event.disposal?.custody?.mostRecentRelease()?.date - ), + event.convictionDate?.let { + Conviction(it, Court(courtName)) + }, + event.disposal?.date?.let { + Sentence( + it, + Court(courtName), + event.disposal.custody?.mostRecentRelease()?.date + ) + }, provider, ogrsScore ) diff --git a/projects/effective-proposal-framework-and-delius/src/test/kotlin/uk/gov/justice/digital/hmpps/epf/CaseDetailsTest.kt b/projects/effective-proposal-framework-and-delius/src/test/kotlin/uk/gov/justice/digital/hmpps/epf/CaseDetailsTest.kt index 0122d98d6b..a372de9344 100644 --- a/projects/effective-proposal-framework-and-delius/src/test/kotlin/uk/gov/justice/digital/hmpps/epf/CaseDetailsTest.kt +++ b/projects/effective-proposal-framework-and-delius/src/test/kotlin/uk/gov/justice/digital/hmpps/epf/CaseDetailsTest.kt @@ -20,7 +20,8 @@ internal class CaseDetailsTest { Name("John", "", "Smith"), LocalDate.of(1982, 8, 3), "Male", - Sentence(null, LocalDate.of(2013, 9, 23), Court("NA Court"), LocalDate.of(2022, 8, 2)), + Conviction(LocalDate.now(), Court("NA Court")), + Sentence(LocalDate.of(2013, 9, 23), Court("NA Court"), LocalDate.of(2022, 8, 2)), Provider("N00", "London"), null )