Skip to content

Lockouts and Overnight Lodgings

Thomas Leese edited this page May 17, 2022 · 3 revisions

See the API documentation for an explanation of lockouts and overnight lodgings.

Journeys logic

📝  Code

A lodged move has multiple completed journeys associated with it, which is not the case of any other kind of move. There is also a potential situation where the lockout has been recorded but the new journeys have not yet been recorded by the supplier.

The logic works as follows:

  • If there are journeys on a different day to the move, assume all the journeys are in place and that is the source of truth.
  • If not, and the move is a lockout, assume the journeys are yet to be added and show "awaiting" destinations and date for a pretend second journey.
  • If the move isn't a lockout, show only the single registered journey.

Handover logic

📝  Code

Similar to the journey logic, with a lodged move we end up in a situation where there can be multiple handovers. For this reason, we've associated handovers with a location and will display them as a list in the frontend.

The logic works as follows:

  • For each journey, find one or more PER handover events for the source location of the journey.
  • If there are no events for that journey, present it as if we are waiting for the handover to be recorded.

Lodging start/end logic

During a lockout, police users can add their own events to a move. The form becomes active when the move has received the lodging start event from the suppliers, and becomes inactive when the lodging end event is received.

A handover for the second journey can be recorded once the lodging start event is received, but will remain if not recorded even if the lodging end event is received. Once it's possible to record the handover for the second journey, it's no longer possible to record the handover for the first journey (if this was forgotten about for example).

Clone this wiki locally