feat: time to next flag

This commit is contained in:
Carlos Valente
2025-07-13 16:52:35 +02:00
parent 637454f73d
commit 445cc9e845
43 changed files with 550 additions and 310 deletions
@@ -427,6 +427,7 @@ describe('getCustomFieldData()', () => {
linkStart: 'link start',
timeEnd: 'time end',
duration: 'duration',
flag: 'flag',
cue: 'cue',
title: 'title',
countToEnd: 'count to end',
@@ -479,6 +480,7 @@ describe('getCustomFieldData()', () => {
linkStart: 'link start',
timeEnd: 'time end',
duration: 'duration',
flag: 'flag',
cue: 'cue',
title: 'title',
countToEnd: 'count to end',
@@ -63,6 +63,7 @@ let rundownMetadata: RundownMetadata = {
playableEventOrder: [],
timedEventOrder: [],
flatEntryOrder: [],
flags: [],
};
const customFieldsMetadata: CustomFieldsMetadata = {
@@ -666,7 +667,7 @@ export function init(initialRundown: Readonly<Rundown>, initialCustomFields: Rea
processedData;
cachedRundown.entries = entries;
cachedRundown.order = order;
cachedRundown.flatOrder = metadata.flatEntryOrder; // TODO: remove in favour of the metadata flatEntryOrder
cachedRundown.flatOrder = metadata.flatEntryOrder;
cachedRundown.revision = rundown.revision;
customFieldsMetadata.assigned = assignedCustomFields;
rundownMetadata = metadata;
@@ -225,6 +225,7 @@ export function makeRundownMetadata(customFields: CustomFields) {
playableEventOrder: [],
timedEventOrder: [],
flatEntryOrder: [],
flags: [],
entries: {},
order: [],
@@ -300,6 +301,11 @@ function processEntry<T extends OntimeEntry>(
processedData.firstStart = currentEntry.timeStart;
}
// check if event is flagged
if (currentEntry.flag) {
processedData.flags.push(currentEntry.id);
}
currentEntry.gap = getTimeFrom(currentEntry, processedData.latestEvent);
if (currentEntry.gap === 0) {
@@ -10,6 +10,7 @@ export type RundownMetadata = {
playableEventOrder: EntryId[]; // flat order of playable events
timedEventOrder: EntryId[]; // flat order of timed events
flatEntryOrder: EntryId[]; // flat order of entries
flags: EntryId[]; // flat order of flagged entries
};
export type AssignedMap = Record<CustomFieldKey, EntryId[]>;