diff --git a/projects/manage-supervision-and-delius/src/integrationTest/kotlin/uk/gov/justice/digital/hmpps/SentenceIntegrationTest.kt b/projects/manage-supervision-and-delius/src/integrationTest/kotlin/uk/gov/justice/digital/hmpps/SentenceIntegrationTest.kt index cf6aa1d4e..bdd58e6dd 100644 --- a/projects/manage-supervision-and-delius/src/integrationTest/kotlin/uk/gov/justice/digital/hmpps/SentenceIntegrationTest.kt +++ b/projects/manage-supervision-and-delius/src/integrationTest/kotlin/uk/gov/justice/digital/hmpps/SentenceIntegrationTest.kt @@ -129,7 +129,7 @@ class SentenceIntegrationTest { "1 days RAR, 1 completed", 12, null, - "my notes", + listOf(NoteDetail(0, note = "my notes", hasNoteBeenTruncated = false)), Rar(completed = 1, scheduled = 0, totalDays = 1) ), Requirement( @@ -142,7 +142,7 @@ class SentenceIntegrationTest { "Unpaid Work - Intensive", 12, null, - "my notes", + listOf(NoteDetail(0, note = "my notes", hasNoteBeenTruncated = false)), null ) ), diff --git a/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/api/model/sentence/LicenceCondition.kt b/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/api/model/sentence/LicenceCondition.kt index 47fc3835e..8260e015c 100644 --- a/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/api/model/sentence/LicenceCondition.kt +++ b/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/api/model/sentence/LicenceCondition.kt @@ -13,14 +13,6 @@ data class LicenceCondition( val licenceConditionNote: NoteDetail? = null ) -data class LicenceConditionNote( - val id: Int, - val createdBy: String? = null, - val createdByDate: LocalDate? = null, - val note: String, - val hasNoteBeenTruncated: Boolean? = null -) - data class LicenceConditionNoteDetail( val personSummary: PersonSummary, val licenceCondition: LicenceCondition? = null diff --git a/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/api/model/sentence/Requirement.kt b/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/api/model/sentence/Requirement.kt index 554d87c6b..0dcb1b510 100644 --- a/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/api/model/sentence/Requirement.kt +++ b/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/api/model/sentence/Requirement.kt @@ -13,7 +13,7 @@ data class Requirement( val description: String, val length: Long?, val lengthUnitValue: String?, - val notes: String?, + val requirementNotes: List? = null, val rar: Rar? = null ) diff --git a/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/service/SentenceService.kt b/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/service/SentenceService.kt index 3d78130f9..f144fb3ee 100644 --- a/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/service/SentenceService.kt +++ b/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/service/SentenceService.kt @@ -155,13 +155,17 @@ class SentenceService( populateRequirementDescription(description, codeDescription, rar), length, lengthUnitValue, - notes, + toRequirementNote(true), rar ) return requirement } + fun RequirementDetails.toRequirementNote(truncateNote: Boolean): List { + return formatNote(notes, truncateNote) + } + fun RequirementDetails.toMinimalRequirement(): MinimalRequirement { val rar = getRar(id, code) return MinimalRequirement(id, populateRequirementDescription(description, codeDescription, rar)) diff --git a/projects/manage-supervision-and-delius/src/test/kotlin/uk/gov/justice/digital/hmpps/service/SentenceServiceTest.kt b/projects/manage-supervision-and-delius/src/test/kotlin/uk/gov/justice/digital/hmpps/service/SentenceServiceTest.kt index 41899a741..77974d10a 100644 --- a/projects/manage-supervision-and-delius/src/test/kotlin/uk/gov/justice/digital/hmpps/service/SentenceServiceTest.kt +++ b/projects/manage-supervision-and-delius/src/test/kotlin/uk/gov/justice/digital/hmpps/service/SentenceServiceTest.kt @@ -235,7 +235,7 @@ class SentenceServiceTest { "${requirement1._description} - ${requirement1._codeDescription}", requirement1._length, requirement1.lengthUnitValue, - requirement1._notes, + listOf(NoteDetail(0, note = requirement1._notes!!, hasNoteBeenTruncated = false)), null ), Requirement( @@ -248,7 +248,7 @@ class SentenceServiceTest { "3 days RAR, 1 completed", requirement2._length, requirement2.lengthUnitValue, - requirement2._notes, + listOf(NoteDetail(0, note = requirement2._notes!!, hasNoteBeenTruncated = false)), Rar(1, 2, 3) ), Requirement( @@ -261,7 +261,7 @@ class SentenceServiceTest { requirement3._description, requirement3._length, requirement3.lengthUnitValue, - requirement3._notes, + listOf(NoteDetail(0, note = requirement3._notes!!, hasNoteBeenTruncated = false)), null ) ), @@ -374,7 +374,7 @@ class SentenceServiceTest { "${requirement1._description} - ${requirement1._codeDescription}", requirement1._length, requirement1.lengthUnitValue, - requirement1._notes, + listOf(NoteDetail(0, note = requirement1._notes!!, hasNoteBeenTruncated = false)), null ) @@ -446,8 +446,7 @@ class SentenceServiceTest { "${requirement1._description} - ${requirement1._codeDescription}", requirement1._length, requirement1.lengthUnitValue, - requirement1._notes, - null + listOf(NoteDetail(0, note = requirement1._notes!!, hasNoteBeenTruncated = false)) ) assertEquals(expected, response.sentence!!.requirements[0])