Fix: sheet export (#1606)

* add util to get keys from labels

* look for existing keys first then create new

* save ontime key to rundown metadata

* update test
This commit is contained in:
Alex Christoffer Rasmussen
2025-05-12 13:56:25 +02:00
committed by GitHub
parent 1f0cde6d0d
commit 1e1aa4bca5
4 changed files with 31 additions and 11 deletions
@@ -1,3 +1,5 @@
import type { CustomFields } from 'ontime-types';
import { isAlphanumericWithSpace } from '../regex-utils/isAlphanumeric.js';
/**
@@ -9,3 +11,11 @@ export const customFieldLabelToKey = (label: string): string | null => {
}
return null;
};
export const customKeyFromLabel = (label: string, fields: CustomFields): string | null => {
const maybeMatchingKey = Object.keys(fields).find((key) => fields[key].label === label);
if (maybeMatchingKey) {
return maybeMatchingKey;
}
return null;
};