mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-21 06:59:09 +00:00
fix: next cue (#1821)
* fix next cue * Update apps/server/src/services/runtime-service/runtime.service.ts 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:
committed by
GitHub
parent
3a0dbf057e
commit
9b36f36f73
@@ -273,13 +273,14 @@ class RuntimeService {
|
|||||||
public startByCue(cue: string): boolean {
|
public startByCue(cue: string): boolean {
|
||||||
const state = runtimeState.getState();
|
const state = runtimeState.getState();
|
||||||
const rundown = getCurrentRundown();
|
const rundown = getCurrentRundown();
|
||||||
const { playableEventOrder } = getRundownMetadata();
|
const { timedEventOrder } = getRundownMetadata();
|
||||||
|
|
||||||
const event = findNextPlayableWithCue(
|
const event = findNextPlayableWithCue(
|
||||||
rundown,
|
rundown,
|
||||||
playableEventOrder,
|
timedEventOrder,
|
||||||
cue,
|
cue,
|
||||||
state.rundown.selectedEventIndex ?? undefined,
|
state.rundown.selectedEventIndex ?? undefined,
|
||||||
|
state.timer.playback === Playback.Armed, // If we are armed allow the armed event to be considered for playback
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!event) {
|
if (!event) {
|
||||||
@@ -341,6 +342,7 @@ class RuntimeService {
|
|||||||
playableEventOrder,
|
playableEventOrder,
|
||||||
cue,
|
cue,
|
||||||
state.rundown.selectedEventIndex ?? undefined,
|
state.rundown.selectedEventIndex ?? undefined,
|
||||||
|
false,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!event) {
|
if (!event) {
|
||||||
|
|||||||
@@ -118,24 +118,25 @@ export function findNextPlayableId(playableEventsOrder: EntryId[], currentEventI
|
|||||||
*/
|
*/
|
||||||
export function findNextPlayableWithCue(
|
export function findNextPlayableWithCue(
|
||||||
rundown: Rundown,
|
rundown: Rundown,
|
||||||
playableEventsOrder: EntryId[],
|
timedEventsOrder: EntryId[],
|
||||||
targetCue: string,
|
targetCue: string,
|
||||||
currentEventIndex = 0,
|
currentEventIndex = 0,
|
||||||
|
allowCurrent = false,
|
||||||
): OntimeEvent | undefined {
|
): OntimeEvent | undefined {
|
||||||
const lowerCaseCue = targetCue.toLowerCase();
|
const startFromIndex = allowCurrent ? currentEventIndex : currentEventIndex + 1;
|
||||||
|
|
||||||
for (let i = currentEventIndex; i < playableEventsOrder.length; i++) {
|
for (let i = startFromIndex; i < timedEventsOrder.length; i++) {
|
||||||
const eventId = playableEventsOrder[i];
|
const eventId = timedEventsOrder[i];
|
||||||
const event = rundown.entries[eventId];
|
const event = rundown.entries[eventId];
|
||||||
if (isOntimeEvent(event) && isPlayableEvent(event) && event.cue.toLowerCase() === lowerCaseCue) {
|
if (isOntimeEvent(event) && isPlayableEvent(event) && event.cue === targetCue) {
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = 0; i < currentEventIndex; i++) {
|
for (let i = 0; i < startFromIndex; i++) {
|
||||||
const eventId = playableEventsOrder[i];
|
const eventId = timedEventsOrder[i];
|
||||||
const event = rundown.entries[eventId];
|
const event = rundown.entries[eventId];
|
||||||
if (isOntimeEvent(event) && isPlayableEvent(event) && event.cue.toLowerCase() === lowerCaseCue) {
|
if (isOntimeEvent(event) && isPlayableEvent(event) && event.cue === targetCue) {
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user