This commit is contained in:
Marshal
2026-07-07 18:40:32 +00:00
parent b57840c907
commit 8addfdf3e2
7 changed files with 529 additions and 74 deletions

View File

@@ -263,14 +263,19 @@ export class BookingWindowService implements OnModuleInit {
) {
const paymentPhaseEndsAt = new Date(now.getTime() + cfg.paymentWindowMinutes * 60_000);
await this.setPhase(schedule, { windowPhase: 'PAYMENT', paymentPhaseEndsAt });
// Run the batch: priority fill over the route-day pool, reserving pay windows
// (or allocating government) — skipped automatically for everyone who fits
// is handled inside the fill (all fit → all reserved → all notified).
await this.bookingBatchService.processRouteDay({
const routeDay = {
originYardId: schedule.originStationId,
destinationYardId: schedule.destinationStationId,
day: eatDay(schedule.scheduledDepartureDate),
});
};
// Doc review is over: bookings staff never accepted (still pending) can no
// longer make this train — expire them BEFORE the batch so they never
// compete for capacity and never reach the pool.
await this.bookingBatchService.expireUnacceptedForRouteDay(routeDay);
// Run the batch: priority fill over the route-day pool, reserving pay windows
// (or allocating government) — skipped automatically for everyone who fits
// is handled inside the fill (all fit → all reserved → all notified).
await this.bookingBatchService.processRouteDay(routeDay);
this.logger.log(
`Batch ran for schedule ${schedule.id}; payment phase until ${paymentPhaseEndsAt.toISOString()}`,
);