mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 05:18:11 +00:00
permision
This commit is contained in:
@@ -253,12 +253,18 @@ export function minLocomotiveLimits(
|
|||||||
maxTrainLengthMeters: Math.min(
|
maxTrainLengthMeters: Math.min(
|
||||||
...locomotives.map((l) => num(l.maxTrainLengthMeters, Infinity) || Infinity),
|
...locomotives.map((l) => num(l.maxTrainLengthMeters, Infinity) || Infinity),
|
||||||
),
|
),
|
||||||
// Weakest locomotive's tolerance governs the set, same as its caps.
|
// Weakest CONFIGURED tolerance governs the set — a locomotive with no
|
||||||
overageToleranceTons: Math.min(...locomotives.map((l) => num(l.overageToleranceTons))),
|
// tolerance set has no opinion, it does not zero out the others.
|
||||||
overageToleranceMeters: Math.min(...locomotives.map((l) => num(l.overageToleranceMeters))),
|
overageToleranceTons: minConfigured(locomotives.map((l) => l.overageToleranceTons)),
|
||||||
|
overageToleranceMeters: minConfigured(locomotives.map((l) => l.overageToleranceMeters)),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function minConfigured(values: Array<number | string | null | undefined>): number {
|
||||||
|
const configured = values.filter((v) => v != null).map((v) => num(v));
|
||||||
|
return configured.length ? Math.min(...configured) : 0;
|
||||||
|
}
|
||||||
|
|
||||||
/** Per-booking train length from wagon count and freight-specific wagon type length. */
|
/** Per-booking train length from wagon count and freight-specific wagon type length. */
|
||||||
export function bookingTrainLengthMeters(
|
export function bookingTrainLengthMeters(
|
||||||
freightType: string | null | undefined,
|
freightType: string | null | undefined,
|
||||||
|
|||||||
Reference in New Issue
Block a user