Skip to content

Commit

Permalink
MAN-36 - update requirement notes
Browse files Browse the repository at this point in the history
  • Loading branch information
achimber-moj committed Jan 10, 2025
1 parent d51e942 commit 47bd8fb
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -142,7 +142,7 @@ class SentenceIntegrationTest {
"Unpaid Work - Intensive",
12,
null,
"my notes",
listOf(NoteDetail(0, note = "my notes", hasNoteBeenTruncated = false)),
null
)
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ data class Requirement(
val description: String,
val length: Long?,
val lengthUnitValue: String?,
val notes: String?,
val requirementNotes: List<NoteDetail>? = null,
val rar: Rar? = null
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,17 @@ class SentenceService(
populateRequirementDescription(description, codeDescription, rar),
length,
lengthUnitValue,
notes,
toRequirementNote(true),
rar
)

return requirement
}

fun RequirementDetails.toRequirementNote(truncateNote: Boolean): List<NoteDetail> {
return formatNote(notes, truncateNote)
}

fun RequirementDetails.toMinimalRequirement(): MinimalRequirement {
val rar = getRar(id, code)
return MinimalRequirement(id, populateRequirementDescription(description, codeDescription, rar))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand All @@ -261,7 +261,7 @@ class SentenceServiceTest {
requirement3._description,
requirement3._length,
requirement3.lengthUnitValue,
requirement3._notes,
listOf(NoteDetail(0, note = requirement3._notes!!, hasNoteBeenTruncated = false)),
null
)
),
Expand Down Expand Up @@ -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
)

Expand Down Expand Up @@ -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])
Expand Down

0 comments on commit 47bd8fb

Please sign in to comment.