add time in block to restore point (#1192)

This commit is contained in:
Alex Christoffer Rasmussen
2024-08-27 13:08:16 +02:00
committed by GitHub
parent 25aefe322b
commit db5fbd8019
4 changed files with 25 additions and 4 deletions
+9 -3
View File
@@ -194,15 +194,16 @@ export function load(
// patch with potential provided data
if (initialData) {
patchTimer(initialData);
const firstStart = initialData?.firstStart;
if (firstStart === null || typeof firstStart === 'number') {
runtimeState.runtime.actualStart = firstStart;
runtimeState.runtime.offset = getRuntimeOffset(runtimeState);
runtimeState.runtime.expectedEnd = getExpectedEnd(runtimeState);
}
if (typeof initialData.blockStartAt === 'number') {
runtimeState.currentBlock.startedAt = initialData.blockStartAt;
}
}
return event.id === runtimeState.eventNow?.id;
}
@@ -680,8 +681,13 @@ function loadBlock(rundown: OntimeRundown) {
const newCurrentBlock = getPreviousBlock(rundown, runtimeState.eventNow.id);
// test all block change posibiletys
const formNoBlockToBlock = runtimeState.currentBlock.block === null && newCurrentBlock !== null;
const formBlockToNoBlock = runtimeState.currentBlock.block !== null && newCurrentBlock === null;
const formBlockToNewBlock = runtimeState.currentBlock.block?.id !== newCurrentBlock?.id;
// update time only if the block has changed
if (newCurrentBlock === null || newCurrentBlock.id !== runtimeState.currentBlock.block?.id) {
if (formNoBlockToBlock || formBlockToNoBlock || formBlockToNewBlock) {
runtimeState.currentBlock.startedAt = null;
}