Implement clearance-first booking flow and completion process for customs contracts

This commit is contained in:
Marshal
2026-07-10 21:51:59 +00:00
parent 9ed473c309
commit 1121e9ce82
19 changed files with 482 additions and 106 deletions

View File

@@ -357,6 +357,10 @@ export class BookingWindowService implements OnModuleInit {
this.logger.log(
`[WINDOW] ${schedule.id} conclude → train FULL — window DONE, finalizing`,
);
// This train is done. If no other train on the route-day can still take
// the waiting list, those bookings have nowhere to go — expire + notify
// them now instead of leaving them FULLY_EXECUTED forever.
await this.bookingBatchService.expireLeftoverDayPool(schedule.id);
return;
}
@@ -390,6 +394,9 @@ export class BookingWindowService implements OnModuleInit {
`[WINDOW] ${schedule.id} conclude → not full but no cycle fits before ` +
`departure — window DONE`,
);
// No further cycle on this train. Same sweep as the FULL branch: if no
// sibling train can still take the day's waiting list, expire + notify.
await this.bookingBatchService.expireLeftoverDayPool(schedule.id);
return;
}