mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-23 07:59:10 +00:00
fix: group expected end
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { isOntimeEvent, MaybeNumber, OntimeBlock, OntimeEvent, Rundown, TimerPhase } from 'ontime-types';
|
import { isOntimeEvent, MaybeNumber, OntimeBlock, Rundown, TimerPhase } from 'ontime-types';
|
||||||
import { calculateTimeUntilStart, dayInMs, isPlaybackActive } from 'ontime-utils';
|
import { calculateTimeUntilStart, dayInMs, getLastEventNormal, isPlaybackActive } from 'ontime-utils';
|
||||||
import type { RuntimeState } from '../stores/runtimeState.js';
|
import type { RuntimeState } from '../stores/runtimeState.js';
|
||||||
import { shouldCrashDev } from '../utils/development.js';
|
import { shouldCrashDev } from '../utils/development.js';
|
||||||
|
|
||||||
@@ -40,13 +40,15 @@ export function getExpectedBlockFinish(state: RuntimeState, rundown: Rundown): M
|
|||||||
isLinkedToLoaded = isLinkedToLoaded && entry.linkStart;
|
isLinkedToLoaded = isLinkedToLoaded && entry.linkStart;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const lastEntry = entries[orderInBlock.at(-1)!] as OntimeEvent;
|
const { lastEvent } = getLastEventNormal(rundown.entries, orderInBlock);
|
||||||
|
if (!lastEvent) return null;
|
||||||
|
|
||||||
const { offsetMode, offset, plannedStart, actualStart } = state.runtime;
|
const { offsetMode, offset, plannedStart, actualStart } = state.runtime;
|
||||||
|
|
||||||
const timeUntilLastEvent = calculateTimeUntilStart({
|
const timeUntilLastEvent = calculateTimeUntilStart({
|
||||||
timeStart: lastEntry.timeStart,
|
timeStart: lastEvent.timeStart,
|
||||||
dayOffset: lastEntry.dayOffset,
|
dayOffset: lastEvent.dayOffset,
|
||||||
delay: lastEntry.delay,
|
delay: lastEvent.delay,
|
||||||
currentDay: eventNow.dayOffset,
|
currentDay: eventNow.dayOffset,
|
||||||
totalGap,
|
totalGap,
|
||||||
isLinkedToLoaded,
|
isLinkedToLoaded,
|
||||||
@@ -57,7 +59,7 @@ export function getExpectedBlockFinish(state: RuntimeState, rundown: Rundown): M
|
|||||||
actualStart,
|
actualStart,
|
||||||
});
|
});
|
||||||
|
|
||||||
return clock + timeUntilLastEvent + lastEntry.duration;
|
return clock + timeUntilLastEvent + lastEvent.duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -723,7 +723,7 @@ export function loadBlock(rundown: Rundown, state = runtimeState) {
|
|||||||
|
|
||||||
//we went into a new block - and it is different from the one we might have come from
|
//we went into a new block - and it is different from the one we might have come from
|
||||||
if ((state.blockNow != null && state.blockNow.id != currentBlockId) || state.blockNow == null) {
|
if ((state.blockNow != null && state.blockNow.id != currentBlockId) || state.blockNow == null) {
|
||||||
state.blockNow = { id: currentBlockId, startedAt: null, expectedEnd: null }; // the id is set here, the start time is set in other placed that handel starting events
|
state.blockNow = { id: currentBlockId, startedAt: null, expectedEnd: null }; // the id is set here, the start time is set when starting events
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user