Skip to content

Commit

Permalink
PI-2063: Fixed order of sentences and added rarActivity flag (#3609)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmcphee77 authored Apr 10, 2024
1 parent 1fafc16 commit 7397e34
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ internal class ComplianceIntegrationTest {
assertThat(res.currentSentences[0].activity.compliedAppointmentsCount, equalTo(2))
assertThat(res.currentSentences[0].activity.outcomeNotRecordedCount, equalTo(3))
assertThat(res.currentSentences[0].activity.acceptableAbsenceCount, equalTo(1))
assertThat(res.previousOrders.orders[0].status, equalTo(TERMINATION_REASON.description))
assertThat(res.previousOrders.orders[1].status, equalTo(TERMINATION_REASON.description))
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ data class Activity(
val isEmailOrTextToPop: Boolean? = false,
val isPhoneCallToPop: Boolean? = false,
val isPastAppointment: Boolean = (isAppointment && ZonedDateTime.now() > startDateTime),
val countsTowardsRAR: Boolean?,
val lastUpdated: ZonedDateTime,
val lastUpdatedBy: Name
)
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ interface ContactRepository : JpaRepository<Contact, Long> {
and (to_char(c.contact_date, 'YYYY-MM-DD') < :dateNow
or (to_char(c.contact_date, 'YYYY-MM-DD') = :dateNow and to_char(c.contact_start_time, 'HH24:MI') < :timeNow))
and c.soft_deleted = 0
order by c.contact_date, c.contact_start_time asc
order by c.contact_date, c.contact_start_time desc
""",
nativeQuery = true
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ interface EventRepository : JpaRepository<Event, Long> {
"LEFT JOIN FETCH e.additionalOffences ao " +
"LEFT JOIN FETCH m.offence mo " +
"LEFT JOIN FETCH ao.offence aoo " +
"WHERE e.personId = :personId"
"WHERE e.personId = :personId " +
"ORDER BY e.eventNumber DESC"
)
fun findByPersonId(personId: Long): List<Event>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ fun Contact.toActivity() = Activity(
officerName = staff?.forename?.let { Name(forename = it, surname = staff.surname) },
rarCategory = requirement?.mainCategory?.description,
rarToolKit = requirement?.mainCategory?.description,
countsTowardsRAR = rarActivity,
rescheduled = rescheduledPop(),
rescheduledStaff = rescheduledPop() || rescheduledStaff(),
rescheduledPop = rescheduledPop(),
Expand Down

0 comments on commit 7397e34

Please sign in to comment.