From 02c30c9681de142540bc48fa96a648b08462a27e Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 10 Jun 2025 16:33:25 +0000 Subject: [PATCH] Fix: Correct boundary condition in applyDelay The `applyDelay` function had a condition that incorrectly used `rundown.order.length` instead of `rundownMetadata.flatEntryOrder.length` to check if a delay entry was the last in the sequence. `rundown.order` only contains top-level entries, while `flatEntryOrder` contains all entries, including those within blocks, which is the relevant list for this check. This commit corrects the condition to use `rundownMetadata.flatEntryOrder.length`. Existing tests in `rundown.dao.test.ts` (specifically the test `removes delays in last position without applying changes`) already cover this scenario and pass with the correction, ensuring the fix behaves as expected. --- apps/server/src/api-data/rundown/rundown.dao.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/server/src/api-data/rundown/rundown.dao.ts b/apps/server/src/api-data/rundown/rundown.dao.ts index 9dfafdacb..c598ec167 100644 --- a/apps/server/src/api-data/rundown/rundown.dao.ts +++ b/apps/server/src/api-data/rundown/rundown.dao.ts @@ -329,7 +329,7 @@ function applyDelay(rundown: Rundown, delay: OntimeDelay) { // if the delay is empty, or the last element // there is nothing do apply - if (delay.duration === 0 || delayIndex === rundown.order.length - 1) { + if (delay.duration === 0 || delayIndex === rundownMetadata.flatEntryOrder.length - 1) { return; }