mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 19:58:11 +00:00
fix
This commit is contained in:
@@ -24,12 +24,27 @@ export const TRAIN_RUN_PAIRS: Record<string, string> = {
|
||||
"9001": "9002",
|
||||
};
|
||||
|
||||
/** Selectable export runs, in run order. */
|
||||
/** Even IMPORT run -> its odd EXPORT run. Derived so the two cannot drift. */
|
||||
const EXPORT_BY_IMPORT: Record<string, string> = Object.fromEntries(
|
||||
Object.entries(TRAIN_RUN_PAIRS).map(([exportRun, importRun]) => [importRun, exportRun]),
|
||||
);
|
||||
|
||||
/** Selectable export runs (odd), in run order. */
|
||||
export const EXPORT_TRAIN_OPTIONS = Object.keys(TRAIN_RUN_PAIRS).map((run) => ({
|
||||
label: run,
|
||||
value: run,
|
||||
}));
|
||||
|
||||
/** Selectable import runs (even), in run order. */
|
||||
export const IMPORT_TRAIN_OPTIONS = Object.values(TRAIN_RUN_PAIRS).map((run) => ({
|
||||
label: run,
|
||||
value: run,
|
||||
}));
|
||||
|
||||
/** The import run implied by an export run; empty string when unset/unknown. */
|
||||
export const importRunFor = (exportRun: unknown): string =>
|
||||
TRAIN_RUN_PAIRS[String(exportRun ?? "")] ?? "";
|
||||
|
||||
/** The export run implied by an import run; empty string when unset/unknown. */
|
||||
export const exportRunFor = (importRun: unknown): string =>
|
||||
EXPORT_BY_IMPORT[String(importRun ?? "")] ?? "";
|
||||
|
||||
Reference in New Issue
Block a user