fix build num

This commit is contained in:
natib21
2026-07-17 10:29:27 +00:00
parent 8671b982c5
commit 3bb4c8fb42
3 changed files with 57 additions and 51 deletions

View File

@@ -0,0 +1,35 @@
/**
* EDR run-number pairs, keyed by the odd EXPORT run (Ethiopia → Djibouti). The
* even IMPORT run (Djibouti → Ethiopia) is fixed by the export run, so choosing
* an export number fully determines the import one.
*
* Run numbers are always 4 digits (8401, never 84001). Pairs are listed out
* rather than computed from the 8001/+100/+1 pattern, so a run that ever breaks
* the convention stays correct here.
*
* Mirrors RUN_WAGONS/IMPORT_RUN in the API's SeedWagonRunNumbers migration —
* keep the two in sync when runs are added or retired.
*/
export const TRAIN_RUN_PAIRS: Record<string, string> = {
"8001": "8002",
"8101": "8102",
"8201": "8202",
"8301": "8302",
"8401": "8402",
"8501": "8502",
"8601": "8602",
"8701": "8702",
"8801": "8802",
"8901": "8902",
"9001": "9002",
};
/** Selectable export runs, in run order. */
export const EXPORT_TRAIN_OPTIONS = Object.keys(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 ?? "")] ?? "";