mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 02:58:11 +00:00
intercity fix
This commit is contained in:
@@ -330,8 +330,10 @@ export class IntercityService {
|
||||
.leftJoinAndSelect('booking.destinationYard', 'destinationYard')
|
||||
.where(`booking.trade_direction = 'DOMESTIC'`)
|
||||
.andWhere('booking.train_schedule_id IS NULL')
|
||||
// PAID = customer paid but staff have not placed it on a train yet
|
||||
// (intercity allocation is manual) — it stays in the pool until they do.
|
||||
.andWhere(
|
||||
`((booking.is_government = false AND booking.status = 'FULLY_EXECUTED')
|
||||
`((booking.is_government = false AND booking.status IN ('FULLY_EXECUTED', 'PAID'))
|
||||
OR (booking.is_government = true AND booking.status = 'APPROVED'))`,
|
||||
)
|
||||
.orderBy('booking.is_government', 'DESC')
|
||||
@@ -382,8 +384,12 @@ export class IntercityService {
|
||||
if (booking.trainScheduleId) {
|
||||
return 'Already assigned to a train';
|
||||
}
|
||||
const readyStatus = booking.isGovernment ? 'APPROVED' : 'FULLY_EXECUTED';
|
||||
if (booking.status !== readyStatus) {
|
||||
// Commercial: FULLY_EXECUTED opens a pay window; PAID (payment landed,
|
||||
// awaiting manual placement) links straight onto the chosen train.
|
||||
const readyStatuses = booking.isGovernment
|
||||
? ['APPROVED']
|
||||
: ['FULLY_EXECUTED', 'PAID'];
|
||||
if (!readyStatuses.includes(booking.status)) {
|
||||
return `Not ready to board (status ${booking.status})`;
|
||||
}
|
||||
if (!this.corridorOnRoute(booking, milestoneSeq)) {
|
||||
|
||||
Reference in New Issue
Block a user