Skip to content

Commit

Permalink
MAN-185 - order by created date, so that double digit event numbers a…
Browse files Browse the repository at this point in the history
…re ordered correctly
  • Loading branch information
achimber-moj committed Nov 29, 2024
1 parent aaeb0ff commit ae0d898
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@ internal class ComplianceIntegrationTest {
res.previousOrders.breaches,
equalTo(2)
)
assertThat(res.currentSentences[0].rarCategory, equalTo("Main"))
assertThat(res.currentSentences[1].rarCategory, equalTo(null))
assertThat(res.currentSentences[0].eventNumber, equalTo("7654321"))
assertThat(res.currentSentences[1].eventNumber, equalTo("1234567"))
assertThat(res.currentSentences[0].activeBreach?.status, equalTo("An NSI Status"))
assertThat(res.currentSentences[0].compliance.breachStarted, equalTo(true))
assertThat(res.currentSentences[0].compliance.currentBreaches, equalTo(1))
assertThat(res.currentSentences[0].activity.waitingForEvidenceCount, equalTo(0))
assertThat(res.currentSentences[0].activity.compliedAppointmentsCount, equalTo(2))
assertThat(res.currentSentences[0].activity.outcomeNotRecordedCount, equalTo(2))
assertThat(res.currentSentences[0].activity.acceptableAbsenceCount, equalTo(0))
assertThat(res.currentSentences[1].rarCategory, equalTo("Main"))
assertThat(res.currentSentences[0].rarCategory, equalTo(null))
assertThat(res.currentSentences[1].eventNumber, equalTo("7654321"))
assertThat(res.currentSentences[0].eventNumber, equalTo("1234567"))
assertThat(res.currentSentences[1].activeBreach?.status, equalTo("An NSI Status"))
assertThat(res.currentSentences[1].compliance.breachStarted, equalTo(true))
assertThat(res.currentSentences[1].compliance.currentBreaches, equalTo(1))
assertThat(res.currentSentences[1].activity.waitingForEvidenceCount, equalTo(0))
assertThat(res.currentSentences[1].activity.compliedAppointmentsCount, equalTo(2))
assertThat(res.currentSentences[1].activity.outcomeNotRecordedCount, equalTo(2))
assertThat(res.currentSentences[1].activity.acceptableAbsenceCount, equalTo(0))
assertThat(res.previousOrders.orders[1].status, equalTo(TERMINATION_REASON.description))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,21 @@ internal class OverviewIntegrationTest {
equalTo(ContactGenerator.FIRST_APPT_CONTACT.type.description)
)
assertThat(res.sentences.size, equalTo(2))
assertThat(res.sentences[0].mainOffence.description, equalTo(MAIN_OFFENCE_1.offence.description))
assertThat(res.sentences[1].mainOffence.description, equalTo(MAIN_OFFENCE_1.offence.description))
assertThat(
res.sentences[0].additionalOffences[0].description,
res.sentences[1].additionalOffences[0].description,
equalTo(ADDITIONAL_OFFENCE_1.offence.description)
)
assertThat(
res.sentences[0].additionalOffences[1].description,
res.sentences[1].additionalOffences[1].description,
equalTo(ADDITIONAL_OFFENCE_2.offence.description)
)
assertThat(res.previousOrders.count, equalTo(2))
assertThat(res.previousOrders.breaches, equalTo(2))
assertThat(res.sentences[0].rar?.completed, equalTo(1))
assertThat(res.sentences[0].rar?.scheduled, equalTo(1))
assertThat(res.sentences[0].rar?.totalDays, equalTo(2))
assertThat(res.sentences[0].eventNumber, equalTo(EVENT_1.eventNumber))
assertThat(res.sentences[1].rar?.completed, equalTo(1))
assertThat(res.sentences[1].rar?.scheduled, equalTo(1))
assertThat(res.sentences[1].rar?.totalDays, equalTo(2))
assertThat(res.sentences[1].eventNumber, equalTo(EVENT_1.eventNumber))
assertThat(res.personalDetails.dateOfBirth, equalTo(OVERVIEW.dateOfBirth))
assertThat(res.personalDetails.dateOfBirth, equalTo(OVERVIEW.dateOfBirth))
assertThat(res.registrations, equalTo(listOf("Restraining Order", "Domestic Abuse Perpetrator")))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ interface EventRepository : JpaRepository<Event, Long> {
"LEFT JOIN FETCH m.offence mo " +
"LEFT JOIN FETCH ao.offence aoo " +
"WHERE e.personId = :personId " +
"ORDER BY e.eventNumber DESC"
"ORDER BY e.dateCreated DESC"
)
fun findByPersonId(personId: Long): List<Event>
}
Expand Down

0 comments on commit ae0d898

Please sign in to comment.