mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-14 11:53:49 +00:00
add time in block to restore point (#1192)
This commit is contained in:
committed by
GitHub
parent
25aefe322b
commit
db5fbd8019
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user