mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-13 19:33:46 +00:00
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:
committed by
GitHub
parent
1f0cde6d0d
commit
1e1aa4bca5
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user