mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 04:08:11 +00:00
intercity fix
This commit is contained in:
@@ -3322,6 +3322,22 @@ export class BookingBatchService implements OnModuleInit {
|
||||
booking: Booking,
|
||||
reason: "paid" | "gov",
|
||||
): Promise<void> {
|
||||
// Stamp the computed wagon need on the link. Several callers pass a booking
|
||||
// loaded without cargo relations (ensurePaidBookingAllocated), and a NULL
|
||||
// wagonsRequired makes every capacity/occupancy reader miscount this
|
||||
// booking as 1 wagon — reload with the relations wagonsFor sizes from.
|
||||
const wagonDims = await this.loadWagonDims();
|
||||
const full =
|
||||
booking.bookingContainers || booking.cargoType
|
||||
? booking
|
||||
: await this.dataSource.getRepository(Booking).findOne({
|
||||
where: { id: booking.id },
|
||||
relations: {
|
||||
bookingContainers: { containerType: true },
|
||||
cargoType: true,
|
||||
},
|
||||
});
|
||||
const wagonsRequired = this.wagonsFor(full ?? booking, wagonDims);
|
||||
await this.dataSource.transaction(async (manager) => {
|
||||
const exists =
|
||||
await this.trainScheduleBookingsRepository.existsForBooking(
|
||||
@@ -3338,6 +3354,7 @@ export class BookingBatchService implements OnModuleInit {
|
||||
status: reason === "paid" ? "PAID" : booking.status,
|
||||
schedulingStatus: "SCHEDULED",
|
||||
scheduledAt: new Date(),
|
||||
wagonsRequired,
|
||||
paymentDeadline: null,
|
||||
selectedForBatchAt: null,
|
||||
} as never);
|
||||
|
||||
Reference in New Issue
Block a user