refactor: show running gap in UI

This commit is contained in:
Carlos Valente
2024-08-27 09:39:32 +02:00
committed by Carlos Valente
parent f5936e5254
commit 73db14c383
10 changed files with 129 additions and 50 deletions
@@ -11,14 +11,7 @@ import {
OntimeRundownEntry,
PlayableEvent,
} from 'ontime-types';
import {
generateId,
insertAtIndex,
reorderArray,
swapEventData,
getTimeFromPrevious,
checkIsNextDay,
} from 'ontime-utils';
import { generateId, insertAtIndex, reorderArray, swapEventData, getTimeFromPrevious, isNewLatest } from 'ontime-utils';
import { getDataProvider } from '../../classes/data-provider/DataProvider.js';
import { createPatch } from '../../utils/parser.js';
import { apply } from './delayUtils.js';
@@ -140,11 +133,7 @@ export function generate(
currentEntry.delay = totalDelay;
// lastEntry is the event with the latest end time
if (
lastEntry === null ||
currentEntry.timeEnd > lastEntry.timeEnd ||
checkIsNextDay(lastEntry.timeStart, currentEntry.timeStart, lastEntry.duration)
) {
if (isNewLatest(currentEntry.timeStart, currentEntry.timeEnd, lastEntry?.timeStart, lastEntry?.timeEnd)) {
lastEntry = currentEntry;
}
}