mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-22 07:29:08 +00:00
Skip fixes (#805)
* refactor: resolve current in time-to-end * refactor: recalculate on skip * Alpha tweaks (#806) * style: small tweaks to interface * refactor: simplify quick add
This commit is contained in:
@@ -68,7 +68,7 @@ export async function addEvent(
|
||||
|
||||
notifyChanges({ timer: [newEvent.id], external: true });
|
||||
|
||||
// notify runtime that rundown size has changed
|
||||
// notify runtime that rundown has changed
|
||||
updateRuntimeOnChange();
|
||||
|
||||
return newEvent;
|
||||
@@ -84,7 +84,7 @@ export async function deleteEvent(eventId: string) {
|
||||
|
||||
notifyChanges({ timer: [eventId], external: true });
|
||||
|
||||
// notify event loader that rundown size has changed
|
||||
// notify event loader that rundown has changed
|
||||
updateRuntimeOnChange();
|
||||
}
|
||||
|
||||
@@ -114,6 +114,9 @@ export async function editEvent(patch: Partial<OntimeEvent> | Partial<OntimeBloc
|
||||
|
||||
notifyChanges({ timer: [patch.id], external: true });
|
||||
|
||||
// notify event loader that rundown has changed
|
||||
updateRuntimeOnChange();
|
||||
|
||||
return newEvent;
|
||||
}
|
||||
|
||||
@@ -127,6 +130,9 @@ export async function batchEditEvents(ids: string[], data: Partial<OntimeEvent>)
|
||||
await scopedMutation({ patch: data, eventIds: ids });
|
||||
|
||||
notifyChanges({ timer: ids, external: true });
|
||||
|
||||
// notify event loader that rundown has changed
|
||||
updateRuntimeOnChange();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -141,6 +147,9 @@ export async function reorderEvent(eventId: string, from: number, to: number) {
|
||||
|
||||
notifyChanges({ timer: true, external: true });
|
||||
|
||||
// notify event loader that rundown has changed
|
||||
updateRuntimeOnChange();
|
||||
|
||||
return reorderedItem;
|
||||
}
|
||||
|
||||
@@ -162,6 +171,9 @@ export async function swapEvents(from: string, to: string) {
|
||||
await scopedMutation({ fromId: from, toId: to });
|
||||
|
||||
notifyChanges({ timer: true, external: true });
|
||||
|
||||
// notify event loader that rundown has changed
|
||||
updateRuntimeOnChange();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -169,7 +181,8 @@ export async function swapEvents(from: string, to: string) {
|
||||
* Called when we make changes to the rundown object
|
||||
*/
|
||||
function updateRuntimeOnChange() {
|
||||
updateRundownData(getPlayableEvents());
|
||||
// schedule an update for the end of the event loop
|
||||
setImmediate(() => updateRundownData(getPlayableEvents()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -180,10 +193,8 @@ export function notifyChanges(options: { timer?: boolean | string[]; external?:
|
||||
const playableEvents = getPlayableEvents();
|
||||
// notify timer service of changed events
|
||||
// timer can be true or an array of changed IDs
|
||||
if (Array.isArray(options.timer)) {
|
||||
runtimeService.maybeUpdate(playableEvents, options.timer);
|
||||
}
|
||||
runtimeService.maybeUpdate(playableEvents);
|
||||
const affected = Array.isArray(options.timer) ? options.timer : undefined;
|
||||
runtimeService.maybeUpdate(playableEvents, affected);
|
||||
}
|
||||
|
||||
if (options.external) {
|
||||
|
||||
Reference in New Issue
Block a user