mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-12 19:03:47 +00:00
chore: improve convention entry <> event
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { DatabaseModel, EndAction, SupportedEvent, TimeStrategy, TimerType } from 'ontime-types';
|
||||
import { DatabaseModel, EndAction, SupportedEntry, TimeStrategy, TimerType } from 'ontime-types';
|
||||
|
||||
export const demoDb: DatabaseModel = {
|
||||
rundowns: {
|
||||
@@ -40,7 +40,7 @@ export const demoDb: DatabaseModel = {
|
||||
],
|
||||
entries: {
|
||||
block: {
|
||||
type: SupportedEvent.Block,
|
||||
type: SupportedEntry.Block,
|
||||
events: ['32d31', '21cd2', '0b371', '3cd28', 'e457f'],
|
||||
id: 'block',
|
||||
title: 'Test Block',
|
||||
@@ -59,7 +59,7 @@ export const demoDb: DatabaseModel = {
|
||||
},
|
||||
},
|
||||
'32d31': {
|
||||
type: SupportedEvent.Event,
|
||||
type: SupportedEntry.Event,
|
||||
id: '32d31',
|
||||
cue: 'SF1.01',
|
||||
title: 'Albania',
|
||||
@@ -88,7 +88,7 @@ export const demoDb: DatabaseModel = {
|
||||
},
|
||||
},
|
||||
'21cd2': {
|
||||
type: SupportedEvent.Event,
|
||||
type: SupportedEntry.Event,
|
||||
id: '21cd2',
|
||||
cue: 'SF1.02',
|
||||
title: 'Latvia',
|
||||
@@ -117,7 +117,7 @@ export const demoDb: DatabaseModel = {
|
||||
},
|
||||
},
|
||||
'0b371': {
|
||||
type: SupportedEvent.Event,
|
||||
type: SupportedEntry.Event,
|
||||
id: '0b371',
|
||||
cue: 'SF1.03',
|
||||
title: 'Lithuania',
|
||||
@@ -146,7 +146,7 @@ export const demoDb: DatabaseModel = {
|
||||
},
|
||||
},
|
||||
'3cd28': {
|
||||
type: SupportedEvent.Event,
|
||||
type: SupportedEntry.Event,
|
||||
id: '3cd28',
|
||||
cue: 'SF1.04',
|
||||
title: 'Switzerland',
|
||||
@@ -175,7 +175,7 @@ export const demoDb: DatabaseModel = {
|
||||
},
|
||||
},
|
||||
e457f: {
|
||||
type: SupportedEvent.Event,
|
||||
type: SupportedEntry.Event,
|
||||
id: 'e457f',
|
||||
cue: 'SF1.05',
|
||||
title: 'Slovenia',
|
||||
@@ -206,7 +206,7 @@ export const demoDb: DatabaseModel = {
|
||||
/// <----- BLOCK
|
||||
'01e85': {
|
||||
// TODO: this should be a marker type
|
||||
type: SupportedEvent.Block,
|
||||
type: SupportedEntry.Block,
|
||||
id: '01e85',
|
||||
title: 'Lunch break',
|
||||
note: '',
|
||||
@@ -222,7 +222,7 @@ export const demoDb: DatabaseModel = {
|
||||
numEvents: 0,
|
||||
},
|
||||
'1c420': {
|
||||
type: SupportedEvent.Event,
|
||||
type: SupportedEntry.Event,
|
||||
id: '1c420',
|
||||
cue: 'SF1.06',
|
||||
title: 'Ukraine',
|
||||
@@ -251,7 +251,7 @@ export const demoDb: DatabaseModel = {
|
||||
},
|
||||
},
|
||||
b7737: {
|
||||
type: SupportedEvent.Event,
|
||||
type: SupportedEntry.Event,
|
||||
id: 'b7737',
|
||||
cue: 'SF1.07',
|
||||
title: 'Bulgaria',
|
||||
@@ -280,7 +280,7 @@ export const demoDb: DatabaseModel = {
|
||||
},
|
||||
},
|
||||
d3a80: {
|
||||
type: SupportedEvent.Event,
|
||||
type: SupportedEntry.Event,
|
||||
id: 'd3a80',
|
||||
cue: 'SF1.08',
|
||||
title: 'Netherlands',
|
||||
@@ -309,7 +309,7 @@ export const demoDb: DatabaseModel = {
|
||||
},
|
||||
},
|
||||
'8276c': {
|
||||
type: SupportedEvent.Event,
|
||||
type: SupportedEntry.Event,
|
||||
id: '8276c',
|
||||
cue: 'SF1.09',
|
||||
title: 'Moldova',
|
||||
@@ -338,7 +338,7 @@ export const demoDb: DatabaseModel = {
|
||||
},
|
||||
},
|
||||
'2340b': {
|
||||
type: SupportedEvent.Event,
|
||||
type: SupportedEntry.Event,
|
||||
id: '2340b',
|
||||
cue: 'SF1.10',
|
||||
title: 'Portugal',
|
||||
@@ -369,7 +369,7 @@ export const demoDb: DatabaseModel = {
|
||||
/// <----- BLOCK
|
||||
cb90b: {
|
||||
// TODO: This should be a marker type
|
||||
type: SupportedEvent.Block,
|
||||
type: SupportedEntry.Block,
|
||||
id: 'cb90b',
|
||||
title: 'Afternoon break',
|
||||
note: '',
|
||||
@@ -385,7 +385,7 @@ export const demoDb: DatabaseModel = {
|
||||
numEvents: 0,
|
||||
},
|
||||
'503c4': {
|
||||
type: SupportedEvent.Event,
|
||||
type: SupportedEntry.Event,
|
||||
id: '503c4',
|
||||
cue: 'SF1.11',
|
||||
title: 'Croatia',
|
||||
@@ -414,7 +414,7 @@ export const demoDb: DatabaseModel = {
|
||||
},
|
||||
},
|
||||
'5e965': {
|
||||
type: SupportedEvent.Event,
|
||||
type: SupportedEntry.Event,
|
||||
id: '5e965',
|
||||
cue: 'SF1.12',
|
||||
title: 'Denmark',
|
||||
@@ -443,7 +443,7 @@ export const demoDb: DatabaseModel = {
|
||||
},
|
||||
},
|
||||
bab4a: {
|
||||
type: SupportedEvent.Event,
|
||||
type: SupportedEntry.Event,
|
||||
id: 'bab4a',
|
||||
cue: 'SF1.13',
|
||||
title: 'Austria',
|
||||
@@ -472,7 +472,7 @@ export const demoDb: DatabaseModel = {
|
||||
},
|
||||
},
|
||||
d3eb1: {
|
||||
type: SupportedEvent.Event,
|
||||
type: SupportedEntry.Event,
|
||||
id: 'd3eb1',
|
||||
cue: 'SF1.14',
|
||||
title: 'Greece',
|
||||
|
||||
@@ -3,13 +3,13 @@ import {
|
||||
OntimeBlock,
|
||||
OntimeDelay,
|
||||
OntimeEvent,
|
||||
SupportedEvent,
|
||||
SupportedEntry,
|
||||
TimeStrategy,
|
||||
TimerType,
|
||||
} from 'ontime-types';
|
||||
|
||||
export const event: Omit<OntimeEvent, 'id' | 'cue'> = {
|
||||
type: SupportedEvent.Event,
|
||||
type: SupportedEntry.Event,
|
||||
title: '',
|
||||
note: '',
|
||||
endAction: EndAction.None,
|
||||
@@ -35,12 +35,12 @@ export const event: Omit<OntimeEvent, 'id' | 'cue'> = {
|
||||
};
|
||||
|
||||
export const delay: Omit<OntimeDelay, 'id'> = {
|
||||
type: SupportedEvent.Delay,
|
||||
type: SupportedEntry.Delay,
|
||||
duration: 0,
|
||||
};
|
||||
|
||||
export const block: Omit<OntimeBlock, 'id'> = {
|
||||
type: SupportedEvent.Block,
|
||||
type: SupportedEntry.Block,
|
||||
title: '',
|
||||
note: '',
|
||||
events: [],
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { SupportedEvent, OntimeEvent, OntimeDelay, OntimeBlock, Rundown } from 'ontime-types';
|
||||
import { SupportedEntry, OntimeEvent, OntimeDelay, OntimeBlock, Rundown } from 'ontime-types';
|
||||
import { defaultRundown } from '../../../models/dataModel.js';
|
||||
|
||||
const baseEvent = {
|
||||
type: SupportedEvent.Event,
|
||||
type: SupportedEntry.Event,
|
||||
skip: false,
|
||||
revision: 1,
|
||||
};
|
||||
|
||||
const baseBlock = {
|
||||
type: SupportedEvent.Block,
|
||||
type: SupportedEntry.Block,
|
||||
events: [],
|
||||
};
|
||||
|
||||
@@ -26,7 +26,7 @@ export function makeOntimeEvent(patch: Partial<OntimeEvent>): OntimeEvent {
|
||||
* Utility to create a delay event
|
||||
*/
|
||||
export function makeOntimeDelay(patch: Partial<OntimeDelay>): OntimeDelay {
|
||||
return { id: 'delay', type: SupportedEvent.Delay, duration: 0, ...patch } as OntimeDelay;
|
||||
return { id: 'delay', type: SupportedEntry.Delay, duration: 0, ...patch } as OntimeDelay;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { OntimeEvent, SupportedEvent } from 'ontime-types';
|
||||
import { OntimeEvent, SupportedEntry } from 'ontime-types';
|
||||
import { MILLIS_PER_HOUR } from 'ontime-utils';
|
||||
|
||||
import { apply } from '../delayUtils.js';
|
||||
@@ -72,7 +72,7 @@ describe('apply()', () => {
|
||||
expect(testRundown.entries).toMatchObject({
|
||||
'1': {
|
||||
id: '1',
|
||||
type: SupportedEvent.Event,
|
||||
type: SupportedEntry.Event,
|
||||
timeStart: 0,
|
||||
timeEnd: 100,
|
||||
duration: 100,
|
||||
@@ -80,7 +80,7 @@ describe('apply()', () => {
|
||||
} as OntimeEvent,
|
||||
'2': {
|
||||
id: '2',
|
||||
type: SupportedEvent.Event,
|
||||
type: SupportedEntry.Event,
|
||||
timeStart: 50,
|
||||
timeEnd: 100,
|
||||
duration: 50,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { CustomFields, OntimeEvent, SupportedEvent, TimeStrategy } from 'ontime-types';
|
||||
import { CustomFields, OntimeEvent, SupportedEntry, TimeStrategy } from 'ontime-types';
|
||||
import { MILLIS_PER_HOUR, MILLIS_PER_MINUTE, dayInMs } from 'ontime-utils';
|
||||
|
||||
import { demoDb } from '../../../models/demoProject.js';
|
||||
@@ -75,9 +75,9 @@ describe('generate()', () => {
|
||||
const initResult = generate(rundown, {});
|
||||
expect(initResult.order.length).toBe(3);
|
||||
expect(initResult.order).toStrictEqual(['1', '2', '3']);
|
||||
expect(initResult.entries['1'].type).toBe(SupportedEvent.Event);
|
||||
expect(initResult.entries['2'].type).toBe(SupportedEvent.Block);
|
||||
expect(initResult.entries['3'].type).toBe(SupportedEvent.Delay);
|
||||
expect(initResult.entries['1'].type).toBe(SupportedEntry.Event);
|
||||
expect(initResult.entries['2'].type).toBe(SupportedEntry.Block);
|
||||
expect(initResult.entries['3'].type).toBe(SupportedEntry.Delay);
|
||||
});
|
||||
|
||||
it('calculates delays versions of a given rundown', () => {
|
||||
@@ -541,7 +541,7 @@ describe('generate() v4', () => {
|
||||
expect(generatedRundown.totalDelay).toBe(0);
|
||||
expect(generatedRundown.entries).toMatchObject({
|
||||
'1': {
|
||||
type: SupportedEvent.Block,
|
||||
type: SupportedEntry.Block,
|
||||
events: ['100', '200', '300'],
|
||||
startTime: 100,
|
||||
endTime: 400,
|
||||
@@ -549,9 +549,9 @@ describe('generate() v4', () => {
|
||||
isFirstLinked: false,
|
||||
numEvents: 3,
|
||||
},
|
||||
'100': { type: SupportedEvent.Event, parent: '1' },
|
||||
'200': { type: SupportedEvent.Event, parent: '1' },
|
||||
'300': { type: SupportedEvent.Event, parent: '1' },
|
||||
'100': { type: SupportedEntry.Event, parent: '1' },
|
||||
'200': { type: SupportedEntry.Event, parent: '1' },
|
||||
'300': { type: SupportedEntry.Event, parent: '1' },
|
||||
});
|
||||
});
|
||||
|
||||
@@ -580,9 +580,9 @@ describe('generate() v4', () => {
|
||||
expect(generatedRundown.totalDuration).toBe(1200);
|
||||
expect(generatedRundown.totalDelay).toBe(0);
|
||||
expect(generatedRundown.entries).toMatchObject({
|
||||
'0': { type: SupportedEvent.Event, parent: null },
|
||||
'0': { type: SupportedEntry.Event, parent: null },
|
||||
'1': {
|
||||
type: SupportedEvent.Block,
|
||||
type: SupportedEntry.Block,
|
||||
events: ['101', '102', '103'],
|
||||
startTime: 100,
|
||||
endTime: 400,
|
||||
@@ -594,7 +594,7 @@ describe('generate() v4', () => {
|
||||
'102': { parent: '1' },
|
||||
'103': { parent: '1' },
|
||||
'2': {
|
||||
type: SupportedEvent.Block,
|
||||
type: SupportedEntry.Block,
|
||||
events: ['201', '202', '203'],
|
||||
startTime: 500,
|
||||
endTime: 800,
|
||||
@@ -606,7 +606,7 @@ describe('generate() v4', () => {
|
||||
'202': { id: '202', timeStart: 600, timeEnd: 700, duration: 100 },
|
||||
'203': { id: '203', timeStart: 700, timeEnd: 800, duration: 100 },
|
||||
'3': {
|
||||
type: SupportedEvent.Block,
|
||||
type: SupportedEntry.Block,
|
||||
events: ['301', '302', '303'],
|
||||
startTime: 900,
|
||||
endTime: 1200,
|
||||
@@ -685,7 +685,7 @@ describe('edit() mutation', () => {
|
||||
expect(newEvent).toMatchObject({
|
||||
id: 'mock',
|
||||
cue: 'patched',
|
||||
type: SupportedEvent.Event,
|
||||
type: SupportedEntry.Event,
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -707,9 +707,9 @@ describe('batchEdit() mutation', () => {
|
||||
const { newRundown } = batchEdit({ rundown, eventIds, patch });
|
||||
|
||||
expect(newRundown.entries).toMatchObject({
|
||||
'1': { id: '1', type: SupportedEvent.Event, cue: 'newData' },
|
||||
'2': { id: '2', type: SupportedEvent.Event, cue: 'data2' },
|
||||
'3': { id: '3', type: SupportedEvent.Event, cue: 'newData' },
|
||||
'1': { id: '1', type: SupportedEntry.Event, cue: 'newData' },
|
||||
'2': { id: '2', type: SupportedEntry.Event, cue: 'data2' },
|
||||
'3': { id: '3', type: SupportedEntry.Event, cue: 'newData' },
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { CustomFields, EndAction, OntimeEvent, SupportedEvent, TimeStrategy, TimerType } from 'ontime-types';
|
||||
import { CustomFields, EndAction, OntimeEvent, SupportedEntry, TimeStrategy, TimerType } from 'ontime-types';
|
||||
import {
|
||||
addToCustomAssignment,
|
||||
calculateDayOffset,
|
||||
@@ -38,7 +38,7 @@ describe('handleCustomField()', () => {
|
||||
const customFieldChangelog = {};
|
||||
|
||||
const event = makeOntimeEvent({
|
||||
type: SupportedEvent.Event,
|
||||
type: SupportedEntry.Event,
|
||||
id: '2',
|
||||
timeStart: 0,
|
||||
linkStart: true,
|
||||
@@ -73,7 +73,7 @@ describe('handleCustomField()', () => {
|
||||
const customFieldChangelog = { sound: 'video' };
|
||||
|
||||
const event = makeOntimeEvent({
|
||||
type: SupportedEvent.Event,
|
||||
type: SupportedEntry.Event,
|
||||
id: '2',
|
||||
timeStart: 0,
|
||||
linkStart: true,
|
||||
@@ -108,7 +108,7 @@ describe('handleCustomField()', () => {
|
||||
const customFieldChangelog = { field1: 'newField1' };
|
||||
|
||||
const mutableEvent = makeOntimeEvent({
|
||||
type: SupportedEvent.Event,
|
||||
type: SupportedEntry.Event,
|
||||
id: 'event1',
|
||||
custom: {
|
||||
field1: 'value1',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { EndAction, OntimeEvent, SupportedEvent, TimeStrategy, TimerType } from 'ontime-types';
|
||||
import { EndAction, OntimeEvent, SupportedEntry, TimeStrategy, TimerType } from 'ontime-types';
|
||||
import { millisToString } from 'ontime-utils';
|
||||
|
||||
import { getA1Notation, cellRequestFromEvent } from '../sheetUtils.js';
|
||||
@@ -21,7 +21,7 @@ describe('getA1Notation()', () => {
|
||||
describe('cellRequestFromEvent()', () => {
|
||||
test('string to string', () => {
|
||||
const event: OntimeEvent = {
|
||||
type: SupportedEvent.Event,
|
||||
type: SupportedEntry.Event,
|
||||
cue: '1',
|
||||
title: 'Fancy',
|
||||
note: 'Blue button on the right',
|
||||
@@ -70,7 +70,7 @@ describe('cellRequestFromEvent()', () => {
|
||||
|
||||
test('number to timer', () => {
|
||||
const event: OntimeEvent = {
|
||||
type: SupportedEvent.Event,
|
||||
type: SupportedEntry.Event,
|
||||
cue: '1',
|
||||
title: 'Fancy',
|
||||
note: 'Blue button on the right',
|
||||
@@ -121,7 +121,7 @@ describe('cellRequestFromEvent()', () => {
|
||||
|
||||
test('boolean to TRUE', () => {
|
||||
const event: OntimeEvent = {
|
||||
type: SupportedEvent.Event,
|
||||
type: SupportedEntry.Event,
|
||||
cue: '1',
|
||||
title: 'Fancy',
|
||||
note: 'Blue button on the right',
|
||||
@@ -171,7 +171,7 @@ describe('cellRequestFromEvent()', () => {
|
||||
|
||||
test('spacing in metadata', () => {
|
||||
const event: OntimeEvent = {
|
||||
type: SupportedEvent.Event,
|
||||
type: SupportedEntry.Event,
|
||||
cue: '1',
|
||||
title: 'Fancy',
|
||||
note: 'Blue button on the right',
|
||||
@@ -207,7 +207,7 @@ describe('cellRequestFromEvent()', () => {
|
||||
|
||||
test('metadata offset from zero', () => {
|
||||
const event: OntimeEvent = {
|
||||
type: SupportedEvent.Event,
|
||||
type: SupportedEntry.Event,
|
||||
cue: '1',
|
||||
title: 'Fancy',
|
||||
note: 'Blue button on the right',
|
||||
@@ -244,7 +244,7 @@ describe('cellRequestFromEvent()', () => {
|
||||
|
||||
test('sheet setup', () => {
|
||||
const event: OntimeEvent = {
|
||||
type: SupportedEvent.Event,
|
||||
type: SupportedEntry.Event,
|
||||
cue: '1',
|
||||
title: 'Fancy',
|
||||
note: 'Blue button on the right',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable no-console -- we are mocking the console */
|
||||
import { assertType, vi } from 'vitest';
|
||||
|
||||
import { CustomFields, DatabaseModel, OntimeEvent, SupportedEvent, TimerType } from 'ontime-types';
|
||||
import { CustomFields, DatabaseModel, OntimeEvent, SupportedEntry, TimerType } from 'ontime-types';
|
||||
import { ImportMap, MILLIS_PER_MINUTE } from 'ontime-utils';
|
||||
|
||||
import { dbModel } from '../../models/dataModel.js';
|
||||
@@ -537,7 +537,7 @@ describe('parseExcel()', () => {
|
||||
const firstEvent = result.rundown.entries[result.rundown.order[0]];
|
||||
|
||||
expect(result.rundown.order.length).toBe(2);
|
||||
expect((firstEvent as OntimeEvent).type).toBe(SupportedEvent.Block);
|
||||
expect((firstEvent as OntimeEvent).type).toBe(SupportedEntry.Block);
|
||||
});
|
||||
|
||||
it('imports as events if there is no timer type column', () => {
|
||||
@@ -553,12 +553,12 @@ describe('parseExcel()', () => {
|
||||
|
||||
expect(result.rundown.order.length).toBe(2);
|
||||
expect(firstEvent).toMatchObject({
|
||||
type: SupportedEvent.Event,
|
||||
type: SupportedEntry.Event,
|
||||
timerType: TimerType.CountDown,
|
||||
});
|
||||
|
||||
expect(secondEvent).toMatchObject({
|
||||
type: SupportedEvent.Event,
|
||||
type: SupportedEntry.Event,
|
||||
timerType: TimerType.CountDown,
|
||||
});
|
||||
});
|
||||
@@ -580,9 +580,9 @@ describe('parseExcel()', () => {
|
||||
const secondEvent = result.rundown.entries[result.rundown.order[1]];
|
||||
const thirdEvent = result.rundown.entries[result.rundown.order[2]];
|
||||
expect(result.rundown.order.length).toBe(3);
|
||||
expect(firstEvent).toMatchObject({ title: 'first', type: SupportedEvent.Event, timerType: TimerType.CountDown });
|
||||
expect(secondEvent).toMatchObject({ title: 'second', type: SupportedEvent.Event, timerType: TimerType.CountDown });
|
||||
expect(thirdEvent).toMatchObject({ title: 'third', type: SupportedEvent.Event, timerType: TimerType.CountUp });
|
||||
expect(firstEvent).toMatchObject({ title: 'first', type: SupportedEntry.Event, timerType: TimerType.CountDown });
|
||||
expect(secondEvent).toMatchObject({ title: 'second', type: SupportedEntry.Event, timerType: TimerType.CountDown });
|
||||
expect(thirdEvent).toMatchObject({ title: 'third', type: SupportedEntry.Event, timerType: TimerType.CountUp });
|
||||
});
|
||||
|
||||
it('am/pm conversion to 24h', () => {
|
||||
@@ -697,7 +697,7 @@ describe('parseExcel()', () => {
|
||||
linkStart: false,
|
||||
},
|
||||
BLOCK: {
|
||||
type: SupportedEvent.Block,
|
||||
type: SupportedEntry.Block,
|
||||
},
|
||||
E: {
|
||||
linkStart: true,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { CustomFields, OntimeBlock, OntimeEvent, Rundown, Settings, SupportedEvent, URLPreset } from 'ontime-types';
|
||||
import { CustomFields, OntimeBlock, OntimeEvent, Rundown, Settings, SupportedEntry, URLPreset } from 'ontime-types';
|
||||
|
||||
import { defaultRundown } from '../../models/dataModel.js';
|
||||
|
||||
@@ -56,8 +56,8 @@ describe('parseRundown()', () => {
|
||||
order: ['1', '2', '3', '4'],
|
||||
flatOrder: ['1', '2', '3', '4'],
|
||||
entries: {
|
||||
'1': { id: '1', type: SupportedEvent.Event, title: 'test', skip: false } as OntimeEvent, // OK
|
||||
'2': { id: '1', type: SupportedEvent.Block, title: 'test 2', skip: false } as OntimeBlock, // duplicate ID
|
||||
'1': { id: '1', type: SupportedEntry.Event, title: 'test', skip: false } as OntimeEvent, // OK
|
||||
'2': { id: '1', type: SupportedEntry.Block, title: 'test 2', skip: false } as OntimeBlock, // duplicate ID
|
||||
'3': {} as OntimeEvent, // no data
|
||||
'4': { id: '4', title: 'test 2', skip: false } as OntimeEvent, // no type
|
||||
},
|
||||
@@ -72,7 +72,7 @@ describe('parseRundown()', () => {
|
||||
expect(parsedRundown.entries).toMatchObject({
|
||||
'1': {
|
||||
id: '1',
|
||||
type: SupportedEvent.Event,
|
||||
type: SupportedEntry.Event,
|
||||
title: 'test',
|
||||
skip: false,
|
||||
},
|
||||
@@ -88,9 +88,9 @@ describe('parseRundown()', () => {
|
||||
flatOrder: ['1', '2'],
|
||||
entries: {
|
||||
// @ts-expect-error -- testing external data which could be incorrect
|
||||
'1': { id: '1', type: SupportedEvent.Event, cue: 101 } as OntimeEvent,
|
||||
'1': { id: '1', type: SupportedEntry.Event, cue: 101 } as OntimeEvent,
|
||||
// @ts-expect-error -- testing external data which could be incorrect
|
||||
'2': { id: '2', type: SupportedEvent.Event, cue: 101.1 } as OntimeEvent,
|
||||
'2': { id: '2', type: SupportedEntry.Event, cue: 101.1 } as OntimeEvent,
|
||||
},
|
||||
revision: 1,
|
||||
} as Rundown;
|
||||
@@ -114,8 +114,8 @@ describe('parseRundown()', () => {
|
||||
order: ['1', '1'],
|
||||
flatOrder: ['1', '1'],
|
||||
entries: {
|
||||
'1': { id: '1', type: SupportedEvent.Event } as OntimeEvent,
|
||||
'2': { id: '2', type: SupportedEvent.Event } as OntimeEvent,
|
||||
'1': { id: '1', type: SupportedEntry.Event } as OntimeEvent,
|
||||
'2': { id: '2', type: SupportedEntry.Event } as OntimeEvent,
|
||||
},
|
||||
revision: 1,
|
||||
} as Rundown;
|
||||
@@ -132,8 +132,8 @@ describe('parseRundown()', () => {
|
||||
order: ['1', '2'],
|
||||
flatOrder: ['1', '2'],
|
||||
entries: {
|
||||
'1': { id: '1', type: SupportedEvent.Event } as OntimeEvent,
|
||||
'2': { id: '2', type: SupportedEvent.Event } as OntimeEvent,
|
||||
'1': { id: '1', type: SupportedEntry.Event } as OntimeEvent,
|
||||
'2': { id: '2', type: SupportedEntry.Event } as OntimeEvent,
|
||||
},
|
||||
revision: 1,
|
||||
} as Rundown;
|
||||
@@ -161,8 +161,8 @@ describe('parseRundown()', () => {
|
||||
order: ['1', '2', '3', '4'],
|
||||
flatOrder: ['1', '2', '3', '4'],
|
||||
entries: {
|
||||
'1': { id: '1', type: SupportedEvent.Event } as OntimeEvent,
|
||||
'2': { id: '2', type: SupportedEvent.Event } as OntimeEvent,
|
||||
'1': { id: '1', type: SupportedEntry.Event } as OntimeEvent,
|
||||
'2': { id: '2', type: SupportedEntry.Event } as OntimeEvent,
|
||||
'not-mentioned': {} as OntimeEvent,
|
||||
},
|
||||
revision: 1,
|
||||
@@ -180,8 +180,8 @@ describe('parseRundown()', () => {
|
||||
order: ['1', '2', '3', '4'],
|
||||
flatOrder: ['1', '2', '3', '4'],
|
||||
entries: {
|
||||
'1': { id: '1', type: SupportedEvent.Event } as OntimeEvent,
|
||||
'2': { id: '2', type: SupportedEvent.Event } as OntimeEvent,
|
||||
'1': { id: '1', type: SupportedEntry.Event } as OntimeEvent,
|
||||
'2': { id: '2', type: SupportedEntry.Event } as OntimeEvent,
|
||||
'not-mentioned': {} as OntimeEvent,
|
||||
},
|
||||
revision: 1,
|
||||
|
||||
@@ -18,7 +18,7 @@ import {
|
||||
OntimeBlock,
|
||||
OntimeEvent,
|
||||
Rundown,
|
||||
SupportedEvent,
|
||||
SupportedEntry,
|
||||
TimerType,
|
||||
TimeStrategy,
|
||||
} from 'ontime-types';
|
||||
@@ -232,10 +232,10 @@ export const parseExcel = (
|
||||
const maybeTimeType = makeString(column, '');
|
||||
if (maybeTimeType === 'block') {
|
||||
// we leave this as a clue for the object filtering later on
|
||||
entry.type = SupportedEvent.Block;
|
||||
entry.type = SupportedEntry.Block;
|
||||
} else if (maybeTimeType === '' || maybeTimeType === 'event' || isKnownTimerType(maybeTimeType)) {
|
||||
// @ts-expect-error -- we leave this as a clue for the object filtering later on
|
||||
entry.type = SupportedEvent.Event;
|
||||
entry.type = SupportedEntry.Event;
|
||||
entry.timerType = validateTimerType(maybeTimeType);
|
||||
} else {
|
||||
// if it is not a block or a known type, we dont import it
|
||||
@@ -320,7 +320,7 @@ export const parseExcel = (
|
||||
const event = {
|
||||
...entry,
|
||||
custom: { ...entryCustomFields },
|
||||
type: SupportedEvent.Event,
|
||||
type: SupportedEntry.Event,
|
||||
} as OntimeEvent;
|
||||
|
||||
if (timerTypeIndex === null) {
|
||||
@@ -407,7 +407,7 @@ export function createPatch(originalEvent: OntimeEvent, patchEvent: Partial<Onti
|
||||
|
||||
return {
|
||||
id: originalEvent.id,
|
||||
type: SupportedEvent.Event,
|
||||
type: SupportedEntry.Event,
|
||||
title: makeString(patchEvent.title, originalEvent.title),
|
||||
timeStart,
|
||||
timeEnd,
|
||||
|
||||
Reference in New Issue
Block a user