From 7e81b71a428dd759e86e75c09f12a8f61a147c6d Mon Sep 17 00:00:00 2001 From: pmcphee77 <150798161+pmcphee77@users.noreply.github.com> Date: Thu, 28 Mar 2024 16:07:49 +0000 Subject: [PATCH] Pi 2035 fix null start time (#3557) * PI-2035: Fix null start time --- .../hmpps/integrations/delius/overview/entity/Contact.kt | 4 ++-- .../gov/justice/digital/hmpps/service/OverviewServiceTest.kt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/integrations/delius/overview/entity/Contact.kt b/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/integrations/delius/overview/entity/Contact.kt index 801dbf0893..09a850dfab 100644 --- a/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/integrations/delius/overview/entity/Contact.kt +++ b/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/integrations/delius/overview/entity/Contact.kt @@ -34,7 +34,7 @@ class Contact( val date: LocalDate = LocalDate.now(), @Column(name = "contact_start_time") - val startTime: ZonedDateTime = ZonedDateTime.now(), + val startTime: ZonedDateTime? = ZonedDateTime.now(), @Column(name = "rar_activity", length = 1) @Convert(converter = YesNoConverter::class) @@ -91,7 +91,7 @@ class Contact( @Column(name = "soft_deleted", columnDefinition = "NUMBER", nullable = false) val softDeleted: Boolean = false ) { - fun startDateTime(): ZonedDateTime = ZonedDateTime.of(date, startTime.toLocalTime(), EuropeLondon) + fun startDateTime(): ZonedDateTime = ZonedDateTime.of(date, startTime?.toLocalTime(), EuropeLondon) fun endDateTime(): ZonedDateTime? = if (endTime != null) ZonedDateTime.of(date, endTime.toLocalTime(), EuropeLondon) else null diff --git a/projects/manage-supervision-and-delius/src/test/kotlin/uk/gov/justice/digital/hmpps/service/OverviewServiceTest.kt b/projects/manage-supervision-and-delius/src/test/kotlin/uk/gov/justice/digital/hmpps/service/OverviewServiceTest.kt index 8de59b0a0f..26a354c6a5 100644 --- a/projects/manage-supervision-and-delius/src/test/kotlin/uk/gov/justice/digital/hmpps/service/OverviewServiceTest.kt +++ b/projects/manage-supervision-and-delius/src/test/kotlin/uk/gov/justice/digital/hmpps/service/OverviewServiceTest.kt @@ -51,7 +51,7 @@ internal class OverviewServiceTest { val crn = "X000004" val expectedAppointmentDateTime = ZonedDateTime.of( FIRST_APPT_CONTACT.date, - FIRST_APPT_CONTACT.startTime.toLocalTime(), + FIRST_APPT_CONTACT.startTime?.toLocalTime(), EuropeLondon ) whenever(personRepository.findByCrn(crn)).thenReturn(PersonGenerator.OVERVIEW)