mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-07 21:15:41 +00:00
fix issues
This commit is contained in:
@@ -836,15 +836,15 @@ export class BookingWagonCancellationService {
|
||||
)
|
||||
.where('alloc.booking_id = :bookingId', { bookingId })
|
||||
.getMany();
|
||||
const loaded = allocations.filter(
|
||||
(a) => a.status === 'LOADED' || a.status === 'DEPARTED',
|
||||
);
|
||||
const remaining = allocations.filter(
|
||||
(a) => a.status !== 'LOADED' && a.status !== 'DEPARTED',
|
||||
);
|
||||
if (!loaded.length) {
|
||||
// A booking whose cargo never showed up at all (0 loaded) is cancelled the
|
||||
// same way — the gate that holds the train does not care whether loading
|
||||
// started, only that nothing is left unresolved.
|
||||
if (!allocations.length) {
|
||||
throw new BadRequestException(
|
||||
'Loading has not started for this booking — use the normal wagon cancellation flow.',
|
||||
'This booking has no wagons on this schedule — use the normal wagon cancellation flow.',
|
||||
);
|
||||
}
|
||||
if (!remaining.length) {
|
||||
|
||||
Reference in New Issue
Block a user