Skip to content

Commit

Permalink
fix: update time in block
Browse files Browse the repository at this point in the history
  • Loading branch information
cpvalente committed Jan 26, 2025
1 parent 5d5b48a commit 699e685
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions apps/server/src/stores/runtimeState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -696,14 +696,14 @@ 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;
// test all block change possibilities
const fromNoBlockToBlock = runtimeState.currentBlock.block === null && newCurrentBlock !== null;
const fromBlockToNoBlock = runtimeState.currentBlock.block !== null && newCurrentBlock === null;
const fromBlockToNewBlock = runtimeState.currentBlock.block?.id !== newCurrentBlock?.id;

// update time only if the block has changed
if (formNoBlockToBlock || formBlockToNoBlock || formBlockToNewBlock) {
runtimeState.currentBlock.startedAt = null;
if (fromNoBlockToBlock || fromBlockToNoBlock || fromBlockToNewBlock) {
runtimeState.currentBlock.startedAt = runtimeState.clock;
}

// update the block anyway
Expand Down

0 comments on commit 699e685

Please sign in to comment.