Skip to content

Commit

Permalink
PI-2279 remove check between movement and booking, as this could be i… (
Browse files Browse the repository at this point in the history
#3907)

PI-2279 remove check between movement and booking, as this could be incorrect for merge cases.  movement api will be correct.

Signed-off-by: Amardeep Chimber <[email protected]>
  • Loading branch information
achimber-moj authored Jun 17, 2024
1 parent db4af8a commit a0916b3
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,14 @@ fun PrisonerMovement?.telemetryProperties(): Map<String, String> = if (this == n

fun Booking.prisonerMovement(movement: Movement): PrisonerMovement {
val dateTime = ZonedDateTime.of(movement.movementDate, movement.movementTime, EuropeLondon)
check(movement.movementType == movementType && movement.movementReason == movementReason) {
"Booking and Last Movement out of sync"
}

if (reason == null) {
throw IgnorableMessageException(
"UnableToCalculateMovementType",
mapOf(
"nomsNumber" to personReference,
"movementType" to movementType,
"movementReason" to movementReason,
"movementType" to movement.movementType,
"movementReason" to movement.movementReason,
"inOutStatus" to inOutStatus!!.name,
"prisonId" to (agencyId ?: "")
)
Expand All @@ -164,7 +162,7 @@ fun Booking.prisonerMovement(movement: Movement): PrisonerMovement {
movement.fromAgency,
movement.toAgency!!,
PrisonerMovement.Type.valueOf(reason),
movementReason,
movement.movementReason,
dateTime
)

Expand All @@ -173,7 +171,7 @@ fun Booking.prisonerMovement(movement: Movement): PrisonerMovement {
movement.fromAgency!!,
movement.toAgency,
PrisonerMovement.Type.valueOf(reason),
movementReason,
movement.movementReason,
dateTime
)

Expand Down

0 comments on commit a0916b3

Please sign in to comment.