Fix: rearrange playing event (#1640)

* creat failing test

* find and pass index of eventNow in case it moved

* fix cache invalidate edits should also recalculate timer

* use coluor as test indicator

* fixed empty cue guard

Co-authored-by: Carlos Valente <34649812+cpvalente@users.noreply.github.com>

---------

Co-authored-by: Carlos Valente <34649812+cpvalente@users.noreply.github.com>
This commit is contained in:
Alex Christoffer Rasmussen
2025-06-17 15:59:23 +02:00
committed by GitHub
parent fb93063b47
commit 4e561cf01f
3 changed files with 34 additions and 5 deletions
@@ -8,6 +8,7 @@ import {
isOntimeDelay,
isOntimeEvent,
OntimeEntry,
OntimeEvent,
PatchWithId,
Rundown,
} from 'ontime-types';
@@ -84,7 +85,7 @@ export async function editEntry(patch: PatchWithId): Promise<OntimeEntry> {
}
// we dont allow the user to change the cue to empty string
if (isOntimeEvent(patch) && patch?.cue === '') {
if ((patch as Partial<OntimeEvent>)?.cue === '') {
throw new Error('Cue value invalid');
}
@@ -107,7 +108,7 @@ export async function editEntry(patch: PatchWithId): Promise<OntimeEntry> {
updateRuntimeOnChange(rundownMetadata);
// notify timer and external services of change
notifyChanges(rundownMetadata, revision, { timer: [entry.id], external: true });
notifyChanges(rundownMetadata, revision, { timer: didInvalidate ? true : [entry.id], external: true });
});
return entry;
@@ -171,7 +172,7 @@ export async function batchEditEntries(ids: EntryId[], patch: Partial<OntimeEntr
updateRuntimeOnChange(rundownMetadata);
// notify timer and external services of change
notifyChanges(rundownMetadata, revision, { timer: changedIds, external: true });
notifyChanges(rundownMetadata, revision, { timer: batchDidInvalidate ? true : changedIds, external: true });
});
return rundownResult;