mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-08 17:03:53 +00:00
add endAction and timerType validation to excel upload (#401)
* add endAction and timerType validation to excel upload * return parser tests + add tests for the excel fields
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { generateId } from 'ontime-utils';
|
||||
import {
|
||||
Alias,
|
||||
EndAction,
|
||||
EventData,
|
||||
OntimeRundown,
|
||||
OSCSettings,
|
||||
@@ -8,6 +9,7 @@ import {
|
||||
OscSubscriptionOptions,
|
||||
Settings,
|
||||
TimerLifeCycle,
|
||||
TimerType,
|
||||
UserFields,
|
||||
ViewSettings,
|
||||
} from 'ontime-types';
|
||||
@@ -41,7 +43,17 @@ export const parseRundown = (data): OntimeRundown => {
|
||||
console.log('ERROR: ID collision on import, skipping');
|
||||
continue;
|
||||
}
|
||||
// validate the right endAction is used
|
||||
if (e.endAction && !Object.values(EndAction).includes(e.endAction)) {
|
||||
e.endAction = EndAction.None;
|
||||
console.log('WARNING: invalid End Action provided, using default');
|
||||
}
|
||||
|
||||
// validate the right timerType is used
|
||||
if (e.timerType && !Object.values(TimerType).includes(e.timerType)) {
|
||||
e.timerType = TimerType.CountDown;
|
||||
console.log('WARNING: invalid Timer Type provided, using default');
|
||||
}
|
||||
if (e.type === 'event') {
|
||||
const event = validateEvent(e);
|
||||
if (event != null) {
|
||||
|
||||
Reference in New Issue
Block a user