From 73afbacdd76c2259c0b4caeebe852730a6ffc9ec Mon Sep 17 00:00:00 2001 From: Carlos Valente Date: Fri, 28 Mar 2025 19:20:43 +0100 Subject: [PATCH] refactor: swap does not copy time data --- packages/utils/src/rundown-utils/rundownUtils.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/utils/src/rundown-utils/rundownUtils.ts b/packages/utils/src/rundown-utils/rundownUtils.ts index 7b33b01ae..622db1aa5 100644 --- a/packages/utils/src/rundown-utils/rundownUtils.ts +++ b/packages/utils/src/rundown-utils/rundownUtils.ts @@ -276,20 +276,32 @@ export function getPreviousEventNormal( export const swapEventData = (eventA: OntimeEvent, eventB: OntimeEvent): { newA: OntimeEvent; newB: OntimeEvent } => { const newA = { ...eventB, + // events keep the ID id: eventA.id, + // events keep the schedule timeStart: eventA.timeStart, timeEnd: eventA.timeEnd, duration: eventA.duration, + linkStart: eventA.linkStart, + // keep schedule metadata delay: eventA.delay, + gap: eventA.gap, + dayOffset: eventA.dayOffset, }; const newB = { ...eventA, + // events keep the ID id: eventB.id, + // events keep the schedule timeStart: eventB.timeStart, timeEnd: eventB.timeEnd, duration: eventB.duration, + linkStart: eventB.linkStart, + // keep schedule metadata delay: eventB.delay, + gap: eventB.gap, + dayOffset: eventB.dayOffset, }; return { newA, newB };