Use CaseGiven information about passengers and the flights they are booked on and alternative flights, attempt to rebook passengers when their flight is cancelled. Higher priority flyers should get earlier alternative flights where possible. Assume all the flights are non-stop for this challenge.The Rules
Here is the core rule sheet that does most of the work:
The implementation looks like this:
A key technique used here is the ->first operator applied to the collection or flights sorted by ascending departure time and to the delayed passengers sorted by decreasing priority. Note that this rule sheet is marked as "iterate" so it will keep going until no more passengers can be rebooked.
See the attached document for more details (including the scope section which is a key part of this rule sheet)