diff --git a/apps/client/src/common/utils/__tests__/eventsManager.test.ts b/apps/client/src/common/utils/__tests__/eventsManager.test.ts index 7cd263229..8e1181108 100644 --- a/apps/client/src/common/utils/__tests__/eventsManager.test.ts +++ b/apps/client/src/common/utils/__tests__/eventsManager.test.ts @@ -15,7 +15,7 @@ describe('cloneEvent()', () => { timeEnd: 10, timerType: TimerType.CountDown, timeStrategy: TimeStrategy.LockEnd, - currentBlock: 'test', + parent: 'test', linkStart: false, countToEnd: false, endAction: EndAction.None, @@ -46,7 +46,7 @@ describe('cloneEvent()', () => { timeEnd: original.timeEnd, timerType: original.timerType, timeStrategy: original.timeStrategy, - currentBlock: 'test', + parent: 'test', countToEnd: original.countToEnd, linkStart: original.linkStart, endAction: original.endAction, diff --git a/apps/client/src/common/utils/eventsManager.ts b/apps/client/src/common/utils/eventsManager.ts index ad22b0820..47334b849 100644 --- a/apps/client/src/common/utils/eventsManager.ts +++ b/apps/client/src/common/utils/eventsManager.ts @@ -23,7 +23,7 @@ export const cloneEvent = (event: OntimeEvent): ClonedEvent => { isPublic: event.isPublic, skip: event.skip, colour: event.colour, - currentBlock: event.currentBlock, + parent: event.parent, revision: 0, delay: event.delay, // the events will be collocated, so having the same metadata is a good start dayOffset: event.dayOffset, diff --git a/apps/server/src/models/demoProject.ts b/apps/server/src/models/demoProject.ts index cb96cef60..58f4a3481 100644 --- a/apps/server/src/models/demoProject.ts +++ b/apps/server/src/models/demoProject.ts @@ -56,7 +56,7 @@ export const demoDb: DatabaseModel = { isPublic: true, skip: false, colour: '', - currentBlock: null, + parent: null, revision: 0, delay: 0, dayOffset: 0, @@ -85,7 +85,7 @@ export const demoDb: DatabaseModel = { isPublic: true, skip: false, colour: '', - currentBlock: null, + parent: null, revision: 0, delay: 0, dayOffset: 0, @@ -114,7 +114,7 @@ export const demoDb: DatabaseModel = { isPublic: true, skip: false, colour: '', - currentBlock: null, + parent: null, revision: 0, delay: 0, dayOffset: 0, @@ -143,7 +143,7 @@ export const demoDb: DatabaseModel = { isPublic: true, skip: false, colour: '', - currentBlock: null, + parent: null, revision: 0, delay: 0, dayOffset: 0, @@ -172,7 +172,7 @@ export const demoDb: DatabaseModel = { isPublic: true, skip: false, colour: '', - currentBlock: null, + parent: null, revision: 0, delay: 0, dayOffset: 0, @@ -219,7 +219,7 @@ export const demoDb: DatabaseModel = { isPublic: true, skip: false, colour: '', - currentBlock: null, + parent: null, revision: 0, delay: 0, dayOffset: 0, @@ -248,7 +248,7 @@ export const demoDb: DatabaseModel = { isPublic: true, skip: false, colour: '', - currentBlock: null, + parent: null, revision: 0, delay: 0, dayOffset: 0, @@ -277,7 +277,7 @@ export const demoDb: DatabaseModel = { isPublic: true, skip: false, colour: '', - currentBlock: null, + parent: null, revision: 0, delay: 0, dayOffset: 0, @@ -306,7 +306,7 @@ export const demoDb: DatabaseModel = { isPublic: true, skip: false, colour: '', - currentBlock: null, + parent: null, revision: 0, delay: 0, dayOffset: 0, @@ -335,7 +335,7 @@ export const demoDb: DatabaseModel = { isPublic: true, skip: false, colour: '', - currentBlock: null, + parent: null, revision: 0, delay: 0, dayOffset: 0, @@ -382,7 +382,7 @@ export const demoDb: DatabaseModel = { isPublic: true, skip: false, colour: '', - currentBlock: null, + parent: null, revision: 0, delay: 0, dayOffset: 0, @@ -411,7 +411,7 @@ export const demoDb: DatabaseModel = { isPublic: true, skip: false, colour: '', - currentBlock: null, + parent: null, revision: 0, delay: 0, dayOffset: 0, @@ -440,7 +440,7 @@ export const demoDb: DatabaseModel = { isPublic: true, skip: false, colour: '', - currentBlock: null, + parent: null, revision: 0, delay: 0, dayOffset: 0, @@ -469,7 +469,7 @@ export const demoDb: DatabaseModel = { isPublic: true, skip: false, colour: '', - currentBlock: null, + parent: null, revision: 0, delay: 0, dayOffset: 0, diff --git a/apps/server/src/models/eventsDefinition.ts b/apps/server/src/models/eventsDefinition.ts index 9775924e0..74cee151a 100644 --- a/apps/server/src/models/eventsDefinition.ts +++ b/apps/server/src/models/eventsDefinition.ts @@ -27,7 +27,7 @@ export const event: Omit = { timeDanger: 60000, custom: {}, // !==== RUNTIME METADATA ====! // - currentBlock: null, + parent: null, revision: 0, // calculated at runtime delay: 0, // calculated at runtime dayOffset: 0, // calculated at runtime diff --git a/apps/server/src/services/rundown-service/__tests__/rundownCache.test.ts b/apps/server/src/services/rundown-service/__tests__/rundownCache.test.ts index 0c644738e..275531017 100644 --- a/apps/server/src/services/rundown-service/__tests__/rundownCache.test.ts +++ b/apps/server/src/services/rundown-service/__tests__/rundownCache.test.ts @@ -536,9 +536,9 @@ describe('generate() v4', () => { isFirstLinked: false, numEvents: 3, }, - '100': { type: SupportedEvent.Event, currentBlock: '1' }, - '200': { type: SupportedEvent.Event, currentBlock: '1' }, - '300': { type: SupportedEvent.Event, currentBlock: '1' }, + '100': { type: SupportedEvent.Event, parent: '1' }, + '200': { type: SupportedEvent.Event, parent: '1' }, + '300': { type: SupportedEvent.Event, parent: '1' }, }); }); @@ -567,7 +567,7 @@ describe('generate() v4', () => { expect(generatedRundown.totalDuration).toBe(1200); expect(generatedRundown.totalDelay).toBe(0); expect(generatedRundown.entries).toMatchObject({ - '0': { type: SupportedEvent.Event, currentBlock: null }, + '0': { type: SupportedEvent.Event, parent: null }, '1': { type: SupportedEvent.Block, events: ['101', '102', '103'], @@ -577,9 +577,9 @@ describe('generate() v4', () => { isFirstLinked: false, numEvents: 3, }, - '101': { currentBlock: '1', gap: 90, linkStart: false }, - '102': { currentBlock: '1' }, - '103': { currentBlock: '1' }, + '101': { parent: '1', gap: 90, linkStart: false }, + '102': { parent: '1' }, + '103': { parent: '1' }, '2': { type: SupportedEvent.Block, events: ['201', '202', '203'], diff --git a/apps/server/src/services/rundown-service/rundownCache.utils.ts b/apps/server/src/services/rundown-service/rundownCache.utils.ts index 42a34e2ac..6397edf5b 100644 --- a/apps/server/src/services/rundown-service/rundownCache.utils.ts +++ b/apps/server/src/services/rundown-service/rundownCache.utils.ts @@ -223,7 +223,7 @@ function processEntry( currentEntry.dayOffset = processedData.totalDays; currentEntry.delay = 0; // this means we dont calculate delays or gaps for skipped events currentEntry.gap = 0; // this means we dont calculate delays or gaps for skipped events - currentEntry.currentBlock = childOfBlock; + currentEntry.parent = childOfBlock; // update rundown metadata, it only concerns playable events if (isPlayableEvent(currentEntry)) { diff --git a/apps/server/src/services/sheet-service/__tests__/sheetUtils.test.ts b/apps/server/src/services/sheet-service/__tests__/sheetUtils.test.ts index 4a650c908..46c6569d3 100644 --- a/apps/server/src/services/sheet-service/__tests__/sheetUtils.test.ts +++ b/apps/server/src/services/sheet-service/__tests__/sheetUtils.test.ts @@ -39,7 +39,7 @@ describe('cellRequestFromEvent()', () => { delay: 0, gap: 0, dayOffset: 0, - currentBlock: null, + parent: null, revision: 0, id: '1358', timeWarning: 0, @@ -85,7 +85,7 @@ describe('cellRequestFromEvent()', () => { isPublic: false, skip: false, colour: 'red', - currentBlock: null, + parent: null, revision: 0, delay: 0, gap: 0, @@ -136,7 +136,7 @@ describe('cellRequestFromEvent()', () => { isPublic: true, skip: false, colour: 'red', - currentBlock: null, + parent: null, revision: 0, delay: 0, gap: 0, @@ -189,7 +189,7 @@ describe('cellRequestFromEvent()', () => { delay: 0, gap: 0, dayOffset: 0, - currentBlock: null, + parent: null, revision: 0, id: '1358', timeWarning: 0, @@ -222,7 +222,7 @@ describe('cellRequestFromEvent()', () => { isPublic: true, skip: false, colour: 'red', - currentBlock: null, + parent: null, revision: 0, delay: 0, gap: 0, @@ -259,7 +259,7 @@ describe('cellRequestFromEvent()', () => { isPublic: true, skip: false, colour: 'red', - currentBlock: null, + parent: null, revision: 0, delay: 0, gap: 0, diff --git a/apps/server/src/stores/__tests__/runtimeState.test.ts b/apps/server/src/stores/__tests__/runtimeState.test.ts index 1c056cd53..d097596ca 100644 --- a/apps/server/src/stores/__tests__/runtimeState.test.ts +++ b/apps/server/src/stores/__tests__/runtimeState.test.ts @@ -28,7 +28,7 @@ const mockEvent = { timeEnd: 1000, duration: 1000, skip: false, - currentBlock: null, + parent: null, } as PlayableEvent; const mockState = { @@ -166,8 +166,8 @@ describe('mutation on runtimeState', () => { // do this before the test so that it is applied const entries = { - event1: { ...mockEvent, id: 'event1', timeStart: 0, timeEnd: 1000, duration: 1000, currentBlock: null }, - event2: { ...mockEvent, id: 'event2', timeStart: 1000, timeEnd: 1500, duration: 500, currentBlock: null }, + event1: { ...mockEvent, id: 'event1', timeStart: 0, timeEnd: 1000, duration: 1000, parent: null }, + event2: { ...mockEvent, id: 'event2', timeStart: 1000, timeEnd: 1500, duration: 500, parent: null }, }; const rundown = makeRundown({ entries, order: ['event1', 'event2'] }); @@ -346,11 +346,11 @@ describe('loadBlock', () => { test('from no-block to a block will clear startedAt', () => { const rundown = makeRundown({ entries: { - 0: makeOntimeEvent({ id: '0', currentBlock: null }), + 0: makeOntimeEvent({ id: '0', parent: null }), 1: makeOntimeBlock({ id: '1', events: ['11'] }), - 11: makeOntimeEvent({ id: '11', currentBlock: '1' }), + 11: makeOntimeEvent({ id: '11', parent: '1' }), 2: makeOntimeBlock({ id: '2', events: [] }), - 3: makeOntimeEvent({ id: '3', currentBlock: null }), + 3: makeOntimeEvent({ id: '3', parent: null }), }, order: ['0', '1', '2', '3'], }); @@ -374,11 +374,11 @@ describe('loadBlock', () => { test('from block to a different block will clear startedAt', () => { const rundown = makeRundown({ entries: { - 0: makeOntimeEvent({ id: '0', currentBlock: null }), + 0: makeOntimeEvent({ id: '0', parent: null }), 1: makeOntimeBlock({ id: '1', events: ['11'] }), - 11: makeOntimeEvent({ id: '11', currentBlock: '1' }), + 11: makeOntimeEvent({ id: '11', parent: '1' }), 2: makeOntimeBlock({ id: '2', events: ['22'] }), - 22: makeOntimeEvent({ id: '22', currentBlock: '2' }), + 22: makeOntimeEvent({ id: '22', parent: '2' }), }, order: ['0', '1', '2'], }); @@ -402,11 +402,11 @@ describe('loadBlock', () => { test('from block to a no-block will clear startedAt', () => { const rundown = makeRundown({ entries: { - 0: makeOntimeEvent({ id: '0', currentBlock: null }), + 0: makeOntimeEvent({ id: '0', parent: null }), 1: makeOntimeBlock({ id: '1', events: ['11'] }), - 11: makeOntimeEvent({ id: '11', currentBlock: '1' }), + 11: makeOntimeEvent({ id: '11', parent: '1' }), 2: makeOntimeBlock({ id: '2', events: ['22'] }), - 22: makeOntimeEvent({ id: '22', currentBlock: '2' }), + 22: makeOntimeEvent({ id: '22', parent: '2' }), }, order: ['0', '1', '2'], }); @@ -431,8 +431,8 @@ describe('loadBlock', () => { const rundown = makeRundown({ entries: { 0: makeOntimeBlock({ id: '0', events: ['1', '2'] }), - 1: makeOntimeEvent({ id: '1', currentBlock: '0' }), - 2: makeOntimeEvent({ id: '2', currentBlock: '0' }), + 1: makeOntimeEvent({ id: '1', parent: '0' }), + 2: makeOntimeEvent({ id: '2', parent: '0' }), }, order: ['0'], }); @@ -456,8 +456,8 @@ describe('loadBlock', () => { test('from no-block to no-block will keep startedAt', () => { const rundown = makeRundown({ entries: { - 0: makeOntimeEvent({ id: '0', currentBlock: null }), - 1: makeOntimeEvent({ id: '1', currentBlock: null }), + 0: makeOntimeEvent({ id: '0', parent: null }), + 1: makeOntimeEvent({ id: '1', parent: null }), }, order: ['0', '1'], }); diff --git a/apps/server/src/stores/runtimeState.ts b/apps/server/src/stores/runtimeState.ts index 54ab4d17c..0afca1b3e 100644 --- a/apps/server/src/stores/runtimeState.ts +++ b/apps/server/src/stores/runtimeState.ts @@ -733,7 +733,7 @@ export function loadBlock(rundown: Rundown, state = runtimeState) { return; } - const currentBlockId = state.eventNow.currentBlock; + const currentBlockId = state.eventNow.parent; // update time only if the block has changed if (state.currentBlock.block?.id != currentBlockId) { diff --git a/apps/server/src/utils/parser.ts b/apps/server/src/utils/parser.ts index b774e8003..47bbe99c8 100644 --- a/apps/server/src/utils/parser.ts +++ b/apps/server/src/utils/parser.ts @@ -424,7 +424,7 @@ export function createPatch(originalEvent: OntimeEvent, patchEvent: Partial { duration: 1, delay: 1, revision: 3, - currentBlock: null, + parent: null, } as OntimeEvent; const eventB = { id: '2', @@ -213,7 +213,7 @@ describe('swapEventData', () => { duration: 2, delay: 2, revision: 7, - currentBlock: 'testing', + parent: 'testing', } as OntimeEvent; const [newA, newB] = swapEventData(eventA, eventB); @@ -226,7 +226,7 @@ describe('swapEventData', () => { duration: 1, delay: 1, revision: 3, - currentBlock: null, + parent: null, }); expect(newB).toMatchObject({ id: '2', @@ -236,7 +236,7 @@ describe('swapEventData', () => { duration: 2, delay: 2, revision: 7, - currentBlock: 'testing', + parent: 'testing', }); }); }); @@ -341,9 +341,9 @@ describe('getLastEvent', () => { entries: { 1: { id: '1', type: SupportedEvent.Event } as OntimeEvent, block: { id: 'block', type: SupportedEvent.Block, events: ['21', '22', '23'] } as OntimeBlock, - 21: { id: '21', type: SupportedEvent.Event, currentBlock: 'block' } as OntimeEvent, - 22: { id: '22', type: SupportedEvent.Event, currentBlock: 'block' } as OntimeEvent, - 23: { id: '23', type: SupportedEvent.Event, currentBlock: 'block' } as OntimeEvent, + 21: { id: '21', type: SupportedEvent.Event, parent: 'block' } as OntimeEvent, + 22: { id: '22', type: SupportedEvent.Event, parent: 'block' } as OntimeEvent, + 23: { id: '23', type: SupportedEvent.Event, parent: 'block' } as OntimeEvent, }, order: ['1', 'block'], }; diff --git a/packages/utils/src/rundown-utils/rundownUtils.ts b/packages/utils/src/rundown-utils/rundownUtils.ts index a3937cb52..571ce793c 100644 --- a/packages/utils/src/rundown-utils/rundownUtils.ts +++ b/packages/utils/src/rundown-utils/rundownUtils.ts @@ -278,7 +278,7 @@ export const swapEventData = (eventA: OntimeEvent, eventB: OntimeEvent): [newA: timeEnd: eventA.timeEnd, duration: eventA.duration, linkStart: eventA.linkStart, - currentBlock: eventA.currentBlock, + parent: eventA.parent, // keep schedule metadata delay: eventA.delay, gap: eventA.gap, @@ -296,7 +296,7 @@ export const swapEventData = (eventA: OntimeEvent, eventB: OntimeEvent): [newA: timeEnd: eventB.timeEnd, duration: eventB.duration, linkStart: eventB.linkStart, - currentBlock: eventB.currentBlock, + parent: eventB.parent, // keep schedule metadata delay: eventB.delay, gap: eventB.gap, @@ -365,8 +365,8 @@ export function getPreviousBlock(rundown: Pick, cu const currentEvent = rundown.entries[currentId]; // check if event is inside a block - if (isOntimeEvent(currentEvent) && currentEvent.currentBlock) { - return rundown.entries[currentEvent.currentBlock] as OntimeBlock; + if (isOntimeEvent(currentEvent) && currentEvent.parent) { + return rundown.entries[currentEvent.parent] as OntimeBlock; } let foundCurrentEvent = false;