Merge pull request #1515 from Tria-plc/freight/fix_issue

import utility functions for booking operations in OperationReschedul…
This commit is contained in:
marshal
2026-09-07 11:03:54 +03:00
committed by GitHub
2 changed files with 16 additions and 1 deletions

View File

@@ -431,6 +431,12 @@ interface BookingWindowRow {
route_stations: string[] | null;
}
/**
* Dispatch crew gate (ITLMS Rolling Stock §1.2). Temporarily disabled so a
* train can depart with no crew assigned; set back to true to enforce.
*/
const ENFORCE_CREW_GATE_ON_DISPATCH = false;
@Injectable()
export class TrainSchedulingService {
private readonly logger = new Logger(TrainSchedulingService.name);
@@ -3198,7 +3204,11 @@ export class TrainSchedulingService {
// Stock §1.2 enforces composition "prior to departure", so an incomplete
// crew saves freely on the assignment page but cannot depart. Optional
// dependency: the positional spec constructors omit it.
await this.trainCrewAssignments?.assertCrewReadyForDispatch(scheduleId);
// TODO(crew-gate): temporarily off so trains can dispatch with no crew
// assigned. Flip ENFORCE_CREW_GATE_ON_DISPATCH once crew rostering is in use.
if (ENFORCE_CREW_GATE_ON_DISPATCH) {
await this.trainCrewAssignments?.assertCrewReadyForDispatch(scheduleId);
}
// Staff may record the departure after the fact — past is fine, future is not.
const now = dto.actualDepartureAt ? new Date(dto.actualDepartureAt) : new Date();
this.assertNotFuture(now, 'Departure time');

View File

@@ -22,6 +22,11 @@ import {
useBookingDetail,
useBookingMutations,
} from "@/hooks/bookings/useBookings";
import {
eatDay,
exportTrainOption,
isExportRailBooking,
} from "@/features/bookings/shipmentDay";
export interface OperationRescheduleModalProps {
bookingId: string;