From 5239da484c1ee711ff498d7dfc3a181e3856d12a Mon Sep 17 00:00:00 2001 From: Johan Nyman Date: Mon, 28 Oct 2024 11:22:28 +0100 Subject: [PATCH] chore: QuickMos: only send mosFullStories for the stories that exist in the RO This allows for a neat trick where one can simply remove stories from the RO in the snapshot to discard them. --- packages/quick-mos/src/convertFromSofieSnapshot.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/quick-mos/src/convertFromSofieSnapshot.ts b/packages/quick-mos/src/convertFromSofieSnapshot.ts index c2d91066..11f59999 100644 --- a/packages/quick-mos/src/convertFromSofieSnapshot.ts +++ b/packages/quick-mos/src/convertFromSofieSnapshot.ts @@ -31,6 +31,11 @@ export function convertFromSofieSnapshot( let segments = segments0.map((s: any) => s.data) segments = segments.sort((a: any, b: any) => b.rank - a.rank) + const storyIDs = new Set() + for (const rundownStory of rundown.data.payload.Stories) { + storyIDs.add(rundownStory.ID) + } + const fullStories: IMOSROFullStory[] = [] const stories: IMOSROStory[] = [] @@ -40,6 +45,8 @@ export function convertFromSofieSnapshot( segment.parts.sort((a: any, b: any) => (a.rank || 0) - (b.rank || 0)) for (const part of segment.parts) { + if (!storyIDs.has(part.payload.ID)) continue + fullStories.push(part.payload) stories.push({ ID: part.payload.ID,