mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 18:48:11 +00:00
booking operations and trains scheduling also allocations
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import { WagonReadiness, type ScheduleTradeDirection } from '@edr/types';
|
||||
|
||||
export function requiredWagonReadiness(
|
||||
direction: ScheduleTradeDirection | string | null | undefined,
|
||||
): WagonReadiness | null {
|
||||
if (direction === 'IMPORT') return WagonReadiness.ImportReady;
|
||||
if (direction === 'EXPORT') return WagonReadiness.ExportReady;
|
||||
return null;
|
||||
}
|
||||
|
||||
export function wagonReadinessMatchesSchedule(
|
||||
wagonReadiness: WagonReadiness | string,
|
||||
direction: ScheduleTradeDirection | string | null | undefined,
|
||||
): boolean {
|
||||
const required = requiredWagonReadiness(direction);
|
||||
if (!required) return true;
|
||||
return wagonReadiness === required;
|
||||
}
|
||||
Reference in New Issue
Block a user