Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/MAN-109-schedule-multiple-appoin…
Browse files Browse the repository at this point in the history
…tments' into MAN-109-schedule-multiple-appointments
  • Loading branch information
achimber-moj committed Nov 4, 2024
2 parents 5dda4f8 + 44ef915 commit ff38c77
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,14 @@ class CreateAppointmentIntegrationTests {
assertThat(appointments.size, equalTo(3))

assertThat(appointments[0].date, equalTo(LocalDate.now()))
assertThat(appointments[1].date, equalTo(LocalDate.now().plusDays(createAppointment.interval.value.toLong() * 1)))
assertThat(appointments[2].date, equalTo(LocalDate.now().plusDays(createAppointment.interval.value.toLong() * 2)))
assertThat(
appointments[1].date,
equalTo(LocalDate.now().plusDays(createAppointment.interval.value.toLong() * 1))
)
assertThat(
appointments[2].date,
equalTo(LocalDate.now().plusDays(createAppointment.interval.value.toLong() * 2))
)

//check for unique external reference
val externalRef = "urn:uk:gov:hmpps:manage-supervision-service:appointment:${createAppointment.uuid}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ class SentenceAppointmentService(

createAppointment.let {
val numberOfAppointments = createAppointment.until?.let {
Period.between(createAppointment.start.toLocalDate(), it.toLocalDate()).days.div(createAppointment.interval.value)
Period.between(
createAppointment.start.toLocalDate(),
it.toLocalDate()
).days.div(createAppointment.interval.value)
} ?: createAppointment.numberOfAppointments

for (i in 0 until numberOfAppointments) {
Expand Down

0 comments on commit ff38c77

Please sign in to comment.