Skip to content

Commit

Permalink
Pi 2035 fix null start time (#3557)
Browse files Browse the repository at this point in the history
* PI-2035: Fix null start time
  • Loading branch information
pmcphee77 authored Mar 28, 2024
1 parent 09704be commit 7e81b71
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 7e81b71

Please sign in to comment.