diff --git a/projects/manage-supervision-and-delius/src/integrationTest/kotlin/uk/gov/justice/digital/hmpps/AppointmentOutcomeIntegrationTest.kt b/projects/manage-supervision-and-delius/src/integrationTest/kotlin/uk/gov/justice/digital/hmpps/AppointmentOutcomeIntegrationTest.kt index 42aa7a3291..91bcdb0ac1 100644 --- a/projects/manage-supervision-and-delius/src/integrationTest/kotlin/uk/gov/justice/digital/hmpps/AppointmentOutcomeIntegrationTest.kt +++ b/projects/manage-supervision-and-delius/src/integrationTest/kotlin/uk/gov/justice/digital/hmpps/AppointmentOutcomeIntegrationTest.kt @@ -89,6 +89,7 @@ class AppointmentOutcomeIntegrationTest { val createdAppointment = appointmentRepository.findById(response.appointments[0].id).get() assertNull(createdAppointment.attended) + assertNull(createdAppointment.complied) assertNull(createdAppointment.notes) assertNull(createdAppointment.outcomeId) assertNull(createdAppointment.sensitive) @@ -106,6 +107,7 @@ class AppointmentOutcomeIntegrationTest { val updatedAppointment = appointmentRepository.findById(response.appointments[0].id).get() assertEquals("Y", updatedAppointment.attended) + assertEquals("Y", updatedAppointment.complied) assertEquals(request.notes, updatedAppointment.notes) assertEquals(ATTENDED_COMPLIED.id, updatedAppointment.outcomeId) assertFalse(updatedAppointment.sensitive!!) diff --git a/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/integrations/delius/sentence/entity/Appointment.kt b/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/integrations/delius/sentence/entity/Appointment.kt index 7d9bb9eac3..18e67ba657 100644 --- a/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/integrations/delius/sentence/entity/Appointment.kt +++ b/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/integrations/delius/sentence/entity/Appointment.kt @@ -83,6 +83,9 @@ class Appointment( @Column(name = "attended", columnDefinition = "char(1)") var attended: String? = null, + @Column(name = "complied", columnDefinition = "char(1") + var complied: String? = null, + @Column(name = "contact_outcome_type_id") var outcomeId: Long? = null, diff --git a/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/service/AppointmentOutcomeService.kt b/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/service/AppointmentOutcomeService.kt index 589ed18335..eb76525b5d 100644 --- a/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/service/AppointmentOutcomeService.kt +++ b/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/service/AppointmentOutcomeService.kt @@ -22,7 +22,8 @@ class AppointmentOutcomeService( appointment.apply { attended = outcome.attended - notes = outcome.notes + complied = if (contactTypeOutcome.outcome.outcomeCompliantAcceptable!!) "Y" else "N" + notes = listOfNotNull(notes, outcome.notes).joinToString(System.lineSeparator()) outcomeId = contactTypeOutcome.outcome.id sensitive = outcome.sensitive }