refactor: maintain flat orders

This commit is contained in:
Carlos Valente
2025-04-17 10:12:06 +02:00
parent ed7f8a0aa2
commit a55dfba4ef
13 changed files with 71 additions and 25 deletions
+5
View File
@@ -74,6 +74,7 @@ export function parseRundown(
title: rundown.title ?? '',
entries: {},
order: [],
flatOrder: [],
revision: rundown.revision ?? 1,
};
@@ -95,6 +96,7 @@ export function parseRundown(
const id = entryId;
let newEvent: OntimeEvent | OntimeDelay | OntimeBlock | null;
const nestedEntryIds: string[] = [];
if (isOntimeEvent(event)) {
newEvent = createEvent(event, eventIndex);
@@ -139,6 +141,7 @@ export function parseRundown(
eventIndex += 1;
if (newNestedEvent) {
nestedEntryIds.push(nestedEventId);
parsedRundown.entries[nestedEventId] = newNestedEvent;
}
}
@@ -162,6 +165,8 @@ export function parseRundown(
if (newEvent) {
parsedRundown.entries[id] = newEvent;
parsedRundown.order.push(id);
parsedRundown.flatOrder.push(id);
parsedRundown.flatOrder.push(...nestedEntryIds);
}
}