mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-07 20:05:41 +00:00
fix issue, add transit flow, fix cancellation
This commit is contained in:
@@ -2320,12 +2320,18 @@ export class TrainSchedulingService {
|
||||
// batch fill, which unlinks it and frees its wagons on the next window cycle.
|
||||
const scheduledAt = new Date();
|
||||
for (const booking of bookings) {
|
||||
const wagonsRequired = sumWagonsRequired(booking, wagonPlan);
|
||||
await this.bookingsRepository.updateSchedulingFields(
|
||||
booking.id,
|
||||
{
|
||||
schedulingStatus: SchedulingStatus.Scheduled,
|
||||
scheduledAt,
|
||||
wagonsRequired: sumWagonsRequired(booking, wagonPlan),
|
||||
wagonsRequired,
|
||||
// Pinned for cancellation pricing: unassign clears wagonsRequired,
|
||||
// this stays. Written once — re-allocation keeps the first stamp.
|
||||
...(Number(booking.cancellationWagons ?? 0) > 0
|
||||
? {}
|
||||
: { cancellationWagons: wagonsRequired }),
|
||||
},
|
||||
manager,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user