From efde7b80b992c6c9f6f1f9127eb48cf875738a2e Mon Sep 17 00:00:00 2001 From: arc-alex Date: Wed, 8 Jan 2025 22:42:38 +0100 Subject: [PATCH] update comments --- .../src/views/timeline/timeline.utils.ts | 2 +- .../utils/src/date-utils/checkIsNextDay.ts | 18 +----------------- .../src/date-utils/getTimeFromPrevious.ts | 3 +-- packages/utils/src/date-utils/isNewLatest.ts | 2 +- 4 files changed, 4 insertions(+), 21 deletions(-) diff --git a/apps/client/src/views/timeline/timeline.utils.ts b/apps/client/src/views/timeline/timeline.utils.ts index 9c7fd712f5..c361d5111f 100644 --- a/apps/client/src/views/timeline/timeline.utils.ts +++ b/apps/client/src/views/timeline/timeline.utils.ts @@ -110,7 +110,7 @@ export function useScopedRundown(rundown: OntimeRundown, selectedEventId: MaybeS let selectedIndex = selectedEventId ? Infinity : -1; let firstStart = null; let totalDuration = 0; - let lastEntry: PlayableEvent | null = null; + let lastEntry: PlayableEvent | undefined; for (let i = 0; i < rundown.length; i++) { const currentEntry = rundown[i]; diff --git a/packages/utils/src/date-utils/checkIsNextDay.ts b/packages/utils/src/date-utils/checkIsNextDay.ts index adea07b853..71a629ba68 100644 --- a/packages/utils/src/date-utils/checkIsNextDay.ts +++ b/packages/utils/src/date-utils/checkIsNextDay.ts @@ -4,26 +4,10 @@ import { dayInMs } from './conversionUtils.js'; /** * Utility function checks whether a given event is the day after from its predecessor - * We consider an event to be the day after, if it begins on a new day - * @example day after - * 09:00 - 10:00 - * 08:00 - 10:30 - * @example day after - * 23:00 - 00:00 - * 02:00 - 03:00 - * @example same day - * 09:00 - 10:00 - * 09:30 - 10:30 - * @example same day, but previous crosses midnight - * 23:00 - 01:00 - * 02:00 - 03:00 - * @example same day, but previous crosses midnight (with overlap) - * 22:00 - 02:00 - * 01:00 - 03:00 */ export function checkIsNextDay( current: Pick, - previous?: Pick | null, + previous?: Pick, ): boolean { if (!previous) { return false; diff --git a/packages/utils/src/date-utils/getTimeFromPrevious.ts b/packages/utils/src/date-utils/getTimeFromPrevious.ts index 86ddd58702..0b96e3ece1 100644 --- a/packages/utils/src/date-utils/getTimeFromPrevious.ts +++ b/packages/utils/src/date-utils/getTimeFromPrevious.ts @@ -3,8 +3,7 @@ import type { OntimeEvent } from 'ontime-types'; import { dayInMs } from './conversionUtils.js'; /** - * Utility returns the time elapsed (gap or overlap) from the previous - * It uses deconstructed parameters to simplify implementation in UI + * Utility returns the gap from previous event */ export function getTimeFromPrevious( current: Pick, diff --git a/packages/utils/src/date-utils/isNewLatest.ts b/packages/utils/src/date-utils/isNewLatest.ts index 38f3fc9022..7bdcfa3420 100644 --- a/packages/utils/src/date-utils/isNewLatest.ts +++ b/packages/utils/src/date-utils/isNewLatest.ts @@ -7,7 +7,7 @@ import { dayInMs } from './conversionUtils.js'; */ export function isNewLatest( currentEvent: Pick, - previousEvent?: Pick | null, + previousEvent?: Pick, ) { // true if there is no previous if (!previousEvent) {