From 3afadcd9f2253d30361ebdf36ab02e90f8780d8a Mon Sep 17 00:00:00 2001 From: Marshal Date: Thu, 9 Jul 2026 13:36:36 +0000 Subject: [PATCH] small fix --- .../modules/train-scheduling/train-scheduling.service.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/edr-freight-api/src/modules/train-scheduling/train-scheduling.service.ts b/apps/edr-freight-api/src/modules/train-scheduling/train-scheduling.service.ts index 00b1bf02a..b72194299 100644 --- a/apps/edr-freight-api/src/modules/train-scheduling/train-scheduling.service.ts +++ b/apps/edr-freight-api/src/modules/train-scheduling/train-scheduling.service.ts @@ -1073,11 +1073,16 @@ export class TrainSchedulingService { containerPlacements ?? [], ); + // The link above puts these bookings on the train: they are SCHEDULED, not + // ELIGIBLE. Leaving them ELIGIBLE re-offers an allocated booking to the next + // batch fill, which unlinks it and frees its wagons on the next window cycle. + const scheduledAt = new Date(); for (const booking of bookings) { await this.bookingsRepository.updateSchedulingFields( booking.id, { - schedulingStatus: SchedulingStatus.Eligible, + schedulingStatus: SchedulingStatus.Scheduled, + scheduledAt, wagonsRequired: sumWagonsRequired(booking), }, manager,