Skip to content

Commit

Permalink
chore: QuickMos: only send mosFullStories for the stories that exist …
Browse files Browse the repository at this point in the history
…in the RO

This allows for a neat trick where one can simply remove stories from the RO in the snapshot to discard them.
  • Loading branch information
nytamin committed Oct 28, 2024
1 parent 7fd531b commit 5239da4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/quick-mos/src/convertFromSofieSnapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string>()
for (const rundownStory of rundown.data.payload.Stories) {
storyIDs.add(rundownStory.ID)
}

const fullStories: IMOSROFullStory[] = []
const stories: IMOSROStory[] = []

Expand All @@ -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,
Expand Down

0 comments on commit 5239da4

Please sign in to comment.