From 2f2c26ed0085e66bc5e18ac3b1ab6224cbcf7312 Mon Sep 17 00:00:00 2001 From: Carlos Valente Date: Wed, 18 Dec 2024 19:43:12 +0100 Subject: [PATCH] chore: rename time-to-end to count-to-end --- apps/client/src/common/hooks/useSocket.ts | 2 +- .../src/common/models/TimeManager.type.ts | 2 +- apps/client/src/common/utils/eventsManager.ts | 2 +- .../import-map/importMapUtils.ts | 4 +-- .../sources-panel/preview/PreviewRundown.tsx | 6 ++-- .../features/control/message/TimerPreview.tsx | 12 +++----- .../src/features/rundown/RundownEntry.tsx | 2 +- .../rundown/event-block/EventBlock.tsx | 6 ++-- .../rundown/event-block/EventBlockInner.tsx | 10 +++---- .../rundown/event-editor/EventEditor.tsx | 2 +- .../composite/EventEditorTimes.tsx | 24 ++++++++-------- .../composite/EventEditorTitles.tsx | 1 - .../rundown/time-input-flow/TimeInputFlow.tsx | 8 +++--- .../src/features/viewers/ViewWrapper.tsx | 2 +- .../src/features/viewers/common/viewUtils.ts | 4 +-- .../viewers/minimal-timer/MinimalTimer.tsx | 2 +- .../src/features/viewers/timer/Timer.tsx | 2 +- apps/server/src/models/demoProject.ts | 28 +++++++++---------- apps/server/src/models/eventsDefinition.ts | 2 +- .../src/services/__tests__/timerUtils.test.ts | 22 +++++++-------- .../__tests__/rundownCache.test.ts | 24 ++++++++-------- .../__tests__/sheetUtils.test.ts | 12 ++++---- apps/server/src/services/timerUtils.ts | 12 ++++---- .../server/src/utils/__tests__/parser.test.ts | 16 +++++------ .../utils/__tests__/parserFunctions.test.ts | 4 +-- apps/server/src/utils/parser.ts | 14 +++++----- apps/server/src/utils/parserFunctions.ts | 4 +-- .../src/definitions/core/OntimeEvent.type.ts | 2 +- .../__tests__/spreadsheetImport.test.ts | 4 +-- .../spreadsheet-import/spreadsheetImport.ts | 2 +- 30 files changed, 115 insertions(+), 122 deletions(-) diff --git a/apps/client/src/common/hooks/useSocket.ts b/apps/client/src/common/hooks/useSocket.ts index 6bd7c934c..06948c53d 100644 --- a/apps/client/src/common/hooks/useSocket.ts +++ b/apps/client/src/common/hooks/useSocket.ts @@ -65,7 +65,7 @@ export const useMessagePreview = () => { showExternalMessage: state.message.timer.secondarySource === 'external' && Boolean(state.message.external), showTimerMessage: state.message.timer.visible && Boolean(state.message.timer.text), timerType: state.eventNow?.timerType ?? null, - isTimeToEnd: state.eventNow?.isTimeToEnd ?? false, + countToEnd: state.eventNow?.countToEnd ?? false, }); return useRuntimeStore(featureSelector); diff --git a/apps/client/src/common/models/TimeManager.type.ts b/apps/client/src/common/models/TimeManager.type.ts index 46bd672a5..3a2a23fb5 100644 --- a/apps/client/src/common/models/TimeManager.type.ts +++ b/apps/client/src/common/models/TimeManager.type.ts @@ -15,5 +15,5 @@ export type ViewExtendedTimer = { clock: number; timerType: TimerType; - isTimeToEnd: boolean; + countToEnd: boolean; }; diff --git a/apps/client/src/common/utils/eventsManager.ts b/apps/client/src/common/utils/eventsManager.ts index 81bf483b6..468c4d931 100644 --- a/apps/client/src/common/utils/eventsManager.ts +++ b/apps/client/src/common/utils/eventsManager.ts @@ -17,7 +17,7 @@ export const cloneEvent = (event: OntimeEvent): ClonedEvent => { timeEnd: event.timeEnd, timerType: event.timerType, timeStrategy: event.timeStrategy, - isTimeToEnd: event.isTimeToEnd, + countToEnd: event.countToEnd, linkStart: event.linkStart, endAction: event.endAction, isPublic: event.isPublic, diff --git a/apps/client/src/features/app-settings/panel/sources-panel/import-map/importMapUtils.ts b/apps/client/src/features/app-settings/panel/sources-panel/import-map/importMapUtils.ts index 506d6c41c..9492ae8ce 100644 --- a/apps/client/src/features/app-settings/panel/sources-panel/import-map/importMapUtils.ts +++ b/apps/client/src/features/app-settings/panel/sources-panel/import-map/importMapUtils.ts @@ -11,7 +11,7 @@ export const namedImportMap = { Duration: 'duration', Cue: 'cue', Title: 'title', - 'Time to end': 'time to end', + 'Count to end': 'count to end', 'Is Public': 'public', Skip: 'skip', Note: 'notes', @@ -48,7 +48,7 @@ export function convertToImportMap(namedImportMap: NamedImportMap): ImportMap { duration: namedImportMap.Duration, cue: namedImportMap.Cue, title: namedImportMap.Title, - isTimeToEnd: namedImportMap['Time to end'], + countToEnd: namedImportMap['Count to end'], isPublic: namedImportMap['Is Public'], skip: namedImportMap.Skip, note: namedImportMap.Note, diff --git a/apps/client/src/features/app-settings/panel/sources-panel/preview/PreviewRundown.tsx b/apps/client/src/features/app-settings/panel/sources-panel/preview/PreviewRundown.tsx index f47a4fa29..dc54b90a0 100644 --- a/apps/client/src/features/app-settings/panel/sources-panel/preview/PreviewRundown.tsx +++ b/apps/client/src/features/app-settings/panel/sources-panel/preview/PreviewRundown.tsx @@ -40,7 +40,7 @@ export default function PreviewRundown(props: PreviewRundownProps) { Duration Warning Time Danger Time - Is Time to End + Count to end Is Public Skip Colour @@ -72,7 +72,7 @@ export default function PreviewRundown(props: PreviewRundownProps) { } eventIndex += 1; const colour = event.colour ? getAccessibleColour(event.colour) : {}; - const isTimeToEnd = booleanToText(event.isTimeToEnd); + const countToEnd = booleanToText(event.countToEnd); const isPublic = booleanToText(event.isPublic); const skip = booleanToText(event.skip); @@ -95,7 +95,7 @@ export default function PreviewRundown(props: PreviewRundownProps) { {millisToString(event.duration)} {millisToString(event.timeWarning)} {millisToString(event.timeDanger)} - {isTimeToEnd && {isTimeToEnd}} + {countToEnd && {countToEnd}} {isPublic && {isPublic}} {skip && {skip}} {event.colour} diff --git a/apps/client/src/features/control/message/TimerPreview.tsx b/apps/client/src/features/control/message/TimerPreview.tsx index 9eaac95d5..97dfa6767 100644 --- a/apps/client/src/features/control/message/TimerPreview.tsx +++ b/apps/client/src/features/control/message/TimerPreview.tsx @@ -16,7 +16,7 @@ import { Corner } from '../../editors/editor-utils/EditorUtils'; import style from './MessageControl.module.scss'; export default function TimerPreview() { - const { blink, blackout, isTimeToEnd, phase, showAuxTimer, showExternalMessage, showTimerMessage, timerType } = + const { blink, blackout, countToEnd, phase, showAuxTimer, showExternalMessage, showTimerMessage, timerType } = useMessagePreview(); const { data } = useViewSettings(); @@ -28,7 +28,7 @@ export default function TimerPreview() { if (phase === TimerPhase.Pending) return 'Standby to start'; if (phase === TimerPhase.Overtime && data.endMessage) return 'Custom end message'; if (timerType === TimerType.Clock) return 'Clock'; - if (isTimeToEnd) return 'Target event scheduled end'; + if (countToEnd) return 'Count to End'; return 'Timer'; })(); @@ -77,12 +77,8 @@ export default function TimerPreview() { - - + + diff --git a/apps/client/src/features/rundown/RundownEntry.tsx b/apps/client/src/features/rundown/RundownEntry.tsx index 806d2f62c..12f9c1659 100644 --- a/apps/client/src/features/rundown/RundownEntry.tsx +++ b/apps/client/src/features/rundown/RundownEntry.tsx @@ -158,7 +158,7 @@ export default function RundownEntry(props: RundownEntryProps) { duration={data.duration} timeStrategy={data.timeStrategy} linkStart={data.linkStart} - isTimeToEnd={data.isTimeToEnd} + countToEnd={data.countToEnd} isPublic={data.isPublic} endAction={data.endAction} timerType={data.timerType} diff --git a/apps/client/src/features/rundown/event-block/EventBlock.tsx b/apps/client/src/features/rundown/event-block/EventBlock.tsx index 096d8c0ad..10e864ab1 100644 --- a/apps/client/src/features/rundown/event-block/EventBlock.tsx +++ b/apps/client/src/features/rundown/event-block/EventBlock.tsx @@ -31,7 +31,7 @@ interface EventBlockProps { duration: number; timeStrategy: TimeStrategy; linkStart: MaybeString; - isTimeToEnd: boolean; + countToEnd: boolean; eventIndex: number; isPublic: boolean; endAction: EndAction; @@ -69,7 +69,7 @@ export default function EventBlock(props: EventBlockProps) { duration, timeStrategy, linkStart, - isTimeToEnd, + countToEnd, isPublic = true, eventIndex, endAction, @@ -288,7 +288,7 @@ export default function EventBlock(props: EventBlockProps) { timeEnd={timeEnd} duration={duration} linkStart={linkStart} - isTimeToEnd={isTimeToEnd} + countToEnd={countToEnd} timeStrategy={timeStrategy} eventId={eventId} eventIndex={eventIndex} diff --git a/apps/client/src/features/rundown/event-block/EventBlockInner.tsx b/apps/client/src/features/rundown/event-block/EventBlockInner.tsx index af9454135..6d64376fa 100644 --- a/apps/client/src/features/rundown/event-block/EventBlockInner.tsx +++ b/apps/client/src/features/rundown/event-block/EventBlockInner.tsx @@ -29,7 +29,7 @@ interface EventBlockInnerProps { duration: number; timeStrategy: TimeStrategy; linkStart: MaybeString; - isTimeToEnd: boolean; + countToEnd: boolean; eventIndex: number; isPublic: boolean; endAction: EndAction; @@ -52,7 +52,7 @@ function EventBlockInner(props: EventBlockInnerProps) { duration, timeStrategy, linkStart, - isTimeToEnd, + countToEnd, isPublic = true, endAction, timerType, @@ -93,7 +93,7 @@ function EventBlockInner(props: EventBlockInnerProps) { delay={delay} timeStrategy={timeStrategy} linkStart={linkStart} - isTimeToEnd={isTimeToEnd} + countToEnd={countToEnd} />
@@ -124,9 +124,9 @@ function EventBlockInner(props: EventBlockInnerProps) { - + - + diff --git a/apps/client/src/features/rundown/event-editor/EventEditor.tsx b/apps/client/src/features/rundown/event-editor/EventEditor.tsx index 05a111059..880dd8eb6 100644 --- a/apps/client/src/features/rundown/event-editor/EventEditor.tsx +++ b/apps/client/src/features/rundown/event-editor/EventEditor.tsx @@ -61,7 +61,7 @@ export default function EventEditor(props: EventEditorProps) { duration={event.duration} timeStrategy={event.timeStrategy} linkStart={event.linkStart} - isTimeToEnd={event.isTimeToEnd} + countToEnd={event.countToEnd} delay={event.delay ?? 0} isPublic={event.isPublic} endAction={event.endAction} diff --git a/apps/client/src/features/rundown/event-editor/composite/EventEditorTimes.tsx b/apps/client/src/features/rundown/event-editor/composite/EventEditorTimes.tsx index 6a5e6e8d5..0920e91f6 100644 --- a/apps/client/src/features/rundown/event-editor/composite/EventEditorTimes.tsx +++ b/apps/client/src/features/rundown/event-editor/composite/EventEditorTimes.tsx @@ -18,7 +18,7 @@ interface EventEditorTimesProps { duration: number; timeStrategy: TimeStrategy; linkStart: MaybeString; - isTimeToEnd: boolean; + countToEnd: boolean; delay: number; isPublic: boolean; endAction: EndAction; @@ -27,7 +27,7 @@ interface EventEditorTimesProps { timeDanger: number; } -type HandledActions = 'isTimeToEnd' | 'timerType' | 'endAction' | 'isPublic' | 'timeWarning' | 'timeDanger'; +type HandledActions = 'countToEnd' | 'timerType' | 'endAction' | 'isPublic' | 'timeWarning' | 'timeDanger'; function EventEditorTimes(props: EventEditorTimesProps) { const { @@ -37,7 +37,7 @@ function EventEditorTimes(props: EventEditorTimesProps) { duration, timeStrategy, linkStart, - isTimeToEnd, + countToEnd, delay, isPublic, endAction, @@ -53,8 +53,8 @@ function EventEditorTimes(props: EventEditorTimesProps) { return; } - if (field === 'isTimeToEnd') { - updateEvent({ id: eventId, isTimeToEnd: !(value as boolean) }); + if (field === 'countToEnd') { + updateEvent({ id: eventId, countToEnd: !(value as boolean) }); return; } @@ -91,13 +91,12 @@ function EventEditorTimes(props: EventEditorTimesProps) { timeStrategy={timeStrategy} linkStart={linkStart} delay={delay} - isTimeToEnd={isTimeToEnd} + countToEnd={countToEnd} />
{delayLabel}
- Event behaviour
End Action @@ -116,22 +115,21 @@ function EventEditorTimes(props: EventEditorTimesProps) {
- Target Event Scheduled End + Count to End handleSubmit('isTimeToEnd', isTimeToEnd)} + isChecked={countToEnd} + onChange={() => handleSubmit('countToEnd', countToEnd)} variant='ontime' /> - {isTimeToEnd ? 'On' : 'Off'} + {countToEnd ? 'On' : 'Off'}
- Display options
Timer Type diff --git a/apps/client/src/features/rundown/event-editor/composite/EventEditorTitles.tsx b/apps/client/src/features/rundown/event-editor/composite/EventEditorTitles.tsx index 73dd88764..02c061238 100644 --- a/apps/client/src/features/rundown/event-editor/composite/EventEditorTitles.tsx +++ b/apps/client/src/features/rundown/event-editor/composite/EventEditorTitles.tsx @@ -29,7 +29,6 @@ const EventEditorTitles = (props: EventEditorTitlesProps) => { return (
- Event data
Event ID (read only) diff --git a/apps/client/src/features/rundown/time-input-flow/TimeInputFlow.tsx b/apps/client/src/features/rundown/time-input-flow/TimeInputFlow.tsx index 175469d76..7b08fc8f4 100644 --- a/apps/client/src/features/rundown/time-input-flow/TimeInputFlow.tsx +++ b/apps/client/src/features/rundown/time-input-flow/TimeInputFlow.tsx @@ -16,7 +16,7 @@ import style from './TimeInputFlow.module.scss'; interface EventBlockTimerProps { eventId: string; - isTimeToEnd: boolean; + countToEnd: boolean; timeStart: number; timeEnd: number; duration: number; @@ -26,7 +26,7 @@ interface EventBlockTimerProps { } function TimeInputFlow(props: EventBlockTimerProps) { - const { eventId, isTimeToEnd, timeStart, timeEnd, duration, timeStrategy, linkStart, delay } = props; + const { eventId, countToEnd, timeStart, timeEnd, duration, timeStrategy, linkStart, delay } = props; const { updateEvent, updateTimer } = useEventAction(); // In sync with EventEditorTimes @@ -47,8 +47,8 @@ function TimeInputFlow(props: EventBlockTimerProps) { warnings.push('Over midnight'); } - if (isTimeToEnd) { - warnings.push('Target event scheduled end'); + if (countToEnd) { + warnings.push('Count to End'); } const hasDelay = delay !== 0; diff --git a/apps/client/src/features/viewers/ViewWrapper.tsx b/apps/client/src/features/viewers/ViewWrapper.tsx index eb6819e20..da10a50c8 100644 --- a/apps/client/src/features/viewers/ViewWrapper.tsx +++ b/apps/client/src/features/viewers/ViewWrapper.tsx @@ -82,7 +82,7 @@ const withData =

(Component: ComponentType

) => { ...timer, clock, timerType: eventNow?.timerType ?? TimerType.CountDown, - isTimeToEnd: eventNow?.isTimeToEnd ?? false, + countToEnd: eventNow?.countToEnd ?? false, }; return ( diff --git a/apps/client/src/features/viewers/common/viewUtils.ts b/apps/client/src/features/viewers/common/viewUtils.ts index 88bcc41c4..66ceb80e6 100644 --- a/apps/client/src/features/viewers/common/viewUtils.ts +++ b/apps/client/src/features/viewers/common/viewUtils.ts @@ -5,14 +5,14 @@ import type { ViewExtendedTimer } from '../../../common/models/TimeManager.type' import { timerPlaceholder, timerPlaceholderMin } from '../../../common/utils/styleUtils'; import { formatTime } from '../../../common/utils/time'; -type TimerTypeParams = Pick; +type TimerTypeParams = Pick; export function getTimerByType(freezeEnd: boolean, timerObject?: TimerTypeParams): number | null { if (!timerObject) { return null; } - if (timerObject.isTimeToEnd) { + if (timerObject.countToEnd) { if (timerObject.current === null) { return null; } diff --git a/apps/client/src/features/viewers/minimal-timer/MinimalTimer.tsx b/apps/client/src/features/viewers/minimal-timer/MinimalTimer.tsx index 83cc0f6d7..5a22a3ec0 100644 --- a/apps/client/src/features/viewers/minimal-timer/MinimalTimer.tsx +++ b/apps/client/src/features/viewers/minimal-timer/MinimalTimer.tsx @@ -124,7 +124,7 @@ export default function MinimalTimer(props: MinimalTimerProps) { const isPlaying = time.playback !== Playback.Pause; - const shouldShowModifiers = time.timerType === TimerType.CountDown || time.isTimeToEnd; + const shouldShowModifiers = time.timerType === TimerType.CountDown || time.countToEnd; const finished = time.phase === TimerPhase.Overtime; const showEndMessage = shouldShowModifiers && finished && viewSettings.endMessage && !hideEndMessage; const showFinished = diff --git a/apps/client/src/features/viewers/timer/Timer.tsx b/apps/client/src/features/viewers/timer/Timer.tsx index a32052cb3..447800ad1 100644 --- a/apps/client/src/features/viewers/timer/Timer.tsx +++ b/apps/client/src/features/viewers/timer/Timer.tsx @@ -118,7 +118,7 @@ export default function Timer(props: TimerProps) { const finished = time.phase === TimerPhase.Overtime; const totalTime = (time.duration ?? 0) + (time.addedTime ?? 0); - const shouldShowModifiers = time.timerType === TimerType.CountDown || time.isTimeToEnd; + const shouldShowModifiers = time.timerType === TimerType.CountDown || time.countToEnd; const showEndMessage = shouldShowModifiers && finished && viewSettings.endMessage; const showProgress = eventNow !== null && diff --git a/apps/server/src/models/demoProject.ts b/apps/server/src/models/demoProject.ts index 91e3abdcc..0733e0a2d 100644 --- a/apps/server/src/models/demoProject.ts +++ b/apps/server/src/models/demoProject.ts @@ -10,7 +10,7 @@ export const demoDb: DatabaseModel = { note: 'SF1.01', endAction: EndAction.None, timerType: TimerType.CountDown, - isTimeToEnd: false, + countToEnd: false, linkStart: null, timeStrategy: TimeStrategy.LockEnd, timeStart: 36000000, @@ -35,7 +35,7 @@ export const demoDb: DatabaseModel = { note: 'SF1.02', endAction: EndAction.None, timerType: TimerType.CountDown, - isTimeToEnd: false, + countToEnd: false, linkStart: null, timeStrategy: TimeStrategy.LockEnd, timeStart: 37500000, @@ -60,7 +60,7 @@ export const demoDb: DatabaseModel = { note: 'SF1.03', endAction: EndAction.None, timerType: TimerType.CountDown, - isTimeToEnd: false, + countToEnd: false, linkStart: null, timeStrategy: TimeStrategy.LockEnd, timeStart: 39000000, @@ -85,7 +85,7 @@ export const demoDb: DatabaseModel = { note: 'SF1.04', endAction: EndAction.None, timerType: TimerType.CountDown, - isTimeToEnd: false, + countToEnd: false, linkStart: null, timeStrategy: TimeStrategy.LockEnd, timeStart: 40500000, @@ -110,7 +110,7 @@ export const demoDb: DatabaseModel = { note: 'SF1.05', endAction: EndAction.None, timerType: TimerType.CountDown, - isTimeToEnd: false, + countToEnd: false, linkStart: null, timeStrategy: TimeStrategy.LockEnd, timeStart: 42000000, @@ -140,7 +140,7 @@ export const demoDb: DatabaseModel = { note: 'SF1.06', endAction: EndAction.None, timerType: TimerType.CountDown, - isTimeToEnd: false, + countToEnd: false, linkStart: null, timeStrategy: TimeStrategy.LockEnd, timeStart: 47100000, @@ -165,7 +165,7 @@ export const demoDb: DatabaseModel = { note: 'SF1.07', endAction: EndAction.None, timerType: TimerType.CountDown, - isTimeToEnd: false, + countToEnd: false, linkStart: null, timeStrategy: TimeStrategy.LockEnd, timeStart: 48600000, @@ -190,7 +190,7 @@ export const demoDb: DatabaseModel = { note: 'SF1.08', endAction: EndAction.None, timerType: TimerType.CountDown, - isTimeToEnd: false, + countToEnd: false, linkStart: null, timeStrategy: TimeStrategy.LockEnd, timeStart: 50100000, @@ -215,7 +215,7 @@ export const demoDb: DatabaseModel = { note: 'SF1.09', endAction: EndAction.None, timerType: TimerType.CountDown, - isTimeToEnd: false, + countToEnd: false, linkStart: null, timeStrategy: TimeStrategy.LockEnd, timeStart: 51600000, @@ -240,7 +240,7 @@ export const demoDb: DatabaseModel = { note: 'SF1.10', endAction: EndAction.None, timerType: TimerType.CountDown, - isTimeToEnd: false, + countToEnd: false, linkStart: null, timeStrategy: TimeStrategy.LockEnd, timeStart: 53100000, @@ -270,7 +270,7 @@ export const demoDb: DatabaseModel = { note: 'SF1.11', endAction: EndAction.None, timerType: TimerType.CountDown, - isTimeToEnd: false, + countToEnd: false, linkStart: null, timeStrategy: TimeStrategy.LockEnd, timeStart: 56100000, @@ -295,7 +295,7 @@ export const demoDb: DatabaseModel = { note: 'SF1.12', endAction: EndAction.None, timerType: TimerType.CountDown, - isTimeToEnd: false, + countToEnd: false, linkStart: null, timeStrategy: TimeStrategy.LockEnd, timeStart: 57600000, @@ -320,7 +320,7 @@ export const demoDb: DatabaseModel = { note: 'SF1.13', endAction: EndAction.None, timerType: TimerType.CountDown, - isTimeToEnd: false, + countToEnd: false, linkStart: null, timeStrategy: TimeStrategy.LockEnd, timeStart: 59100000, @@ -345,7 +345,7 @@ export const demoDb: DatabaseModel = { note: 'SF1.14', endAction: EndAction.None, timerType: TimerType.CountDown, - isTimeToEnd: false, + countToEnd: false, linkStart: null, timeStrategy: TimeStrategy.LockEnd, timeStart: 60600000, diff --git a/apps/server/src/models/eventsDefinition.ts b/apps/server/src/models/eventsDefinition.ts index cc8bc563c..40b7a4650 100644 --- a/apps/server/src/models/eventsDefinition.ts +++ b/apps/server/src/models/eventsDefinition.ts @@ -15,7 +15,7 @@ export const event: Omit = { timerType: TimerType.CountDown, timeStrategy: TimeStrategy.LockDuration, linkStart: null, - isTimeToEnd: false, + countToEnd: false, timeStart: 0, timeEnd: 0, duration: 0, diff --git a/apps/server/src/services/__tests__/timerUtils.test.ts b/apps/server/src/services/__tests__/timerUtils.test.ts index 01fd0276c..e15bd33b6 100644 --- a/apps/server/src/services/__tests__/timerUtils.test.ts +++ b/apps/server/src/services/__tests__/timerUtils.test.ts @@ -175,7 +175,7 @@ describe('getExpectedFinish()', () => { const state = { eventNow: { timeEnd: 30, - isTimeToEnd: true, + countToEnd: true, }, timer: { addedTime: 10, @@ -195,7 +195,7 @@ describe('getExpectedFinish()', () => { const state = { eventNow: { timeEnd: 600000, // 00:10:00 - isTimeToEnd: true, + countToEnd: true, }, timer: { addedTime: 0, @@ -346,12 +346,12 @@ describe('getCurrent()', () => { expect(current).toBe(35); }); - describe('on timers of type time-to-end', () => { + describe('on timers of type count-to-end', () => { it('current time is the time to end even if it hasnt started, this is weird, but by design', () => { const state = { eventNow: { timeEnd: 100, - isTimeToEnd: true, + countToEnd: true, }, clock: 30, timer: { @@ -376,7 +376,7 @@ describe('getCurrent()', () => { const state = { eventNow: { timeEnd: 100, - isTimeToEnd: true, + countToEnd: true, }, clock: 30, timer: { @@ -401,7 +401,7 @@ describe('getCurrent()', () => { const state = { eventNow: { timeEnd: 100, - isTimeToEnd: true, + countToEnd: true, }, clock: 30, timer: { @@ -427,7 +427,7 @@ describe('getCurrent()', () => { eventNow: { timeStart: 79200000, // 22:00:00 timeEnd: 600000, // 00:10:00 - isTimeToEnd: true, + countToEnd: true, }, clock: 79500000, // 22:05:00 timer: { @@ -456,7 +456,7 @@ describe('getCurrent()', () => { timeStart: 77400000, // 21:30:00 timeEnd: 81000000, // 22:30:00 duration: 3600000, // 01:00:00 - isTimeToEnd: true, + countToEnd: true, }, timer: { addedTime: 0, @@ -910,7 +910,7 @@ describe('getRuntimeOffset()', () => { linkStart: null, endAction: EndAction.None, timerType: TimerType.CountDown, - isTimeToEnd: true, + countToEnd: true, isPublic: true, skip: false, note: '', @@ -963,7 +963,7 @@ describe('getRuntimeOffset()', () => { linkStart: null, endAction: EndAction.None, timerType: TimerType.CountDown, - isTimeToEnd: true, + countToEnd: true, isPublic: true, skip: false, note: '', @@ -1014,7 +1014,7 @@ describe('getRuntimeOffset()', () => { linkStart: null, endAction: EndAction.None, timerType: TimerType.CountDown, - isTimeToEnd: true, + countToEnd: true, }, runtime: { selectedEventIndex: 0, diff --git a/apps/server/src/services/rundown-service/__tests__/rundownCache.test.ts b/apps/server/src/services/rundown-service/__tests__/rundownCache.test.ts index 5eccaeacc..dc7dced1d 100644 --- a/apps/server/src/services/rundown-service/__tests__/rundownCache.test.ts +++ b/apps/server/src/services/rundown-service/__tests__/rundownCache.test.ts @@ -565,7 +565,7 @@ describe('calculateRuntimeDelays', () => { note: '', endAction: EndAction.None, timerType: TimerType.CountDown, - isTimeToEnd: false, + countToEnd: false, timeStrategy: TimeStrategy.LockEnd, linkStart: null, timeStart: 600000, @@ -592,7 +592,7 @@ describe('calculateRuntimeDelays', () => { note: '', endAction: EndAction.None, timerType: TimerType.CountDown, - isTimeToEnd: false, + countToEnd: false, timeStrategy: TimeStrategy.LockEnd, linkStart: null, timeStart: 1200000, @@ -619,7 +619,7 @@ describe('calculateRuntimeDelays', () => { note: '', endAction: EndAction.None, timerType: TimerType.CountDown, - isTimeToEnd: false, + countToEnd: false, timeStrategy: TimeStrategy.LockEnd, linkStart: null, timeStart: 600000, @@ -646,7 +646,7 @@ describe('calculateRuntimeDelays', () => { note: '', endAction: EndAction.None, timerType: TimerType.CountDown, - isTimeToEnd: false, + countToEnd: false, timeStrategy: TimeStrategy.LockEnd, linkStart: null, timeStart: 1200000, @@ -682,7 +682,7 @@ describe('getDelayAt()', () => { note: '', endAction: EndAction.None, timerType: TimerType.CountDown, - isTimeToEnd: false, + countToEnd: false, timeStrategy: TimeStrategy.LockEnd, linkStart: null, timeStart: 600000, @@ -710,7 +710,7 @@ describe('getDelayAt()', () => { note: '', endAction: EndAction.None, timerType: TimerType.CountDown, - isTimeToEnd: false, + countToEnd: false, timeStrategy: TimeStrategy.LockEnd, linkStart: null, timeStart: 1200000, @@ -738,7 +738,7 @@ describe('getDelayAt()', () => { note: '', endAction: EndAction.None, timerType: TimerType.CountDown, - isTimeToEnd: false, + countToEnd: false, timeStrategy: TimeStrategy.LockEnd, linkStart: null, timeStart: 600000, @@ -766,7 +766,7 @@ describe('getDelayAt()', () => { note: '', endAction: EndAction.None, timerType: TimerType.CountDown, - isTimeToEnd: false, + countToEnd: false, timeStrategy: TimeStrategy.LockEnd, linkStart: null, timeStart: 1200000, @@ -820,7 +820,7 @@ describe('calculateRuntimeDelaysFrom()', () => { note: '', endAction: EndAction.None, timerType: TimerType.CountDown, - isTimeToEnd: false, + countToEnd: false, timeStrategy: TimeStrategy.LockEnd, linkStart: null, timeStart: 600000, @@ -848,7 +848,7 @@ describe('calculateRuntimeDelaysFrom()', () => { note: '', endAction: EndAction.None, timerType: TimerType.CountDown, - isTimeToEnd: false, + countToEnd: false, timeStrategy: TimeStrategy.LockEnd, linkStart: null, timeStart: 1200000, @@ -876,7 +876,7 @@ describe('calculateRuntimeDelaysFrom()', () => { note: '', endAction: EndAction.None, timerType: TimerType.CountDown, - isTimeToEnd: false, + countToEnd: false, timeStrategy: TimeStrategy.LockEnd, linkStart: null, timeStart: 600000, @@ -904,7 +904,7 @@ describe('calculateRuntimeDelaysFrom()', () => { note: '', endAction: EndAction.None, timerType: TimerType.CountDown, - isTimeToEnd: false, + countToEnd: false, timeStrategy: TimeStrategy.LockEnd, linkStart: null, timeStart: 1200000, diff --git a/apps/server/src/services/sheet-service/__tests__/sheetUtils.test.ts b/apps/server/src/services/sheet-service/__tests__/sheetUtils.test.ts index c4fb5c6b0..0e7ed8565 100644 --- a/apps/server/src/services/sheet-service/__tests__/sheetUtils.test.ts +++ b/apps/server/src/services/sheet-service/__tests__/sheetUtils.test.ts @@ -31,7 +31,7 @@ describe('cellRequestFromEvent()', () => { linkStart: null, endAction: EndAction.None, timerType: TimerType.CountDown, - isTimeToEnd: false, + countToEnd: false, duration: 10800000, isPublic: false, skip: false, @@ -74,7 +74,7 @@ describe('cellRequestFromEvent()', () => { timeEnd: 57600000, endAction: EndAction.None, timerType: TimerType.CountDown, - isTimeToEnd: false, + countToEnd: false, duration: 10800000, timeStrategy: TimeStrategy.LockEnd, linkStart: null, @@ -121,7 +121,7 @@ describe('cellRequestFromEvent()', () => { timeEnd: 57600000, endAction: EndAction.None, timerType: TimerType.CountDown, - isTimeToEnd: false, + countToEnd: false, duration: 10800000, timeStrategy: TimeStrategy.LockEnd, linkStart: null, @@ -167,7 +167,7 @@ describe('cellRequestFromEvent()', () => { timeEnd: 57600000, endAction: EndAction.None, timerType: TimerType.CountDown, - isTimeToEnd: false, + countToEnd: false, timeStrategy: TimeStrategy.LockEnd, linkStart: null, duration: 10800000, @@ -199,7 +199,7 @@ describe('cellRequestFromEvent()', () => { timeEnd: 57600000, endAction: EndAction.None, timerType: TimerType.CountDown, - isTimeToEnd: false, + countToEnd: false, duration: 10800000, timeStrategy: TimeStrategy.LockEnd, linkStart: null, @@ -232,7 +232,7 @@ describe('cellRequestFromEvent()', () => { timeEnd: 57600000, endAction: EndAction.None, timerType: TimerType.CountDown, - isTimeToEnd: false, + countToEnd: false, duration: 10800000, timeStrategy: TimeStrategy.LockEnd, linkStart: null, diff --git a/apps/server/src/services/timerUtils.ts b/apps/server/src/services/timerUtils.ts index 3b56e0e12..54f698a9b 100644 --- a/apps/server/src/services/timerUtils.ts +++ b/apps/server/src/services/timerUtils.ts @@ -19,7 +19,7 @@ export function getExpectedFinish(state: RuntimeState): MaybeNumber { return null; } - const { isTimeToEnd, timeEnd } = state.eventNow; + const { countToEnd, timeEnd } = state.eventNow; const { pausedAt } = state._timer; const { clock } = state; @@ -33,7 +33,7 @@ export function getExpectedFinish(state: RuntimeState): MaybeNumber { const pausedTime = pausedAt != null ? clock - pausedAt : 0; - if (isTimeToEnd) { + if (countToEnd) { return timeEnd + addedTime + pausedTime; } @@ -62,11 +62,11 @@ export function getCurrent(state: RuntimeState): number { } } const { startedAt, duration, addedTime } = state.timer; - const { isTimeToEnd, timeStart, timeEnd } = state.eventNow; + const { countToEnd, timeStart, timeEnd } = state.eventNow; const { pausedAt } = state._timer; const { clock } = state; - if (isTimeToEnd) { + if (countToEnd) { const isEventOverMidnight = timeStart > timeEnd; const correctDay = isEventOverMidnight ? dayInMs : 0; return correctDay - clock + timeEnd + addedTime; @@ -131,7 +131,7 @@ export function getRuntimeOffset(state: RuntimeState): number { } const { clock } = state; - const { isTimeToEnd, timeStart } = state.eventNow; + const { countToEnd, timeStart } = state.eventNow; const { addedTime, current, startedAt } = state.timer; // if we havent started, but the timer is armed @@ -142,7 +142,7 @@ export function getRuntimeOffset(state: RuntimeState): number { const overtime = Math.min(current, 0); // in time-to-end, offset is overtime - if (isTimeToEnd) { + if (countToEnd) { return overtime; } diff --git a/apps/server/src/utils/__tests__/parser.test.ts b/apps/server/src/utils/__tests__/parser.test.ts index 955f48223..779d9e400 100644 --- a/apps/server/src/utils/__tests__/parser.test.ts +++ b/apps/server/src/utils/__tests__/parser.test.ts @@ -471,7 +471,7 @@ describe('test event validator', () => { note: expect.any(String), timeStart: expect.any(Number), timeEnd: expect.any(Number), - isTimeToEnd: expect.any(Boolean), + countToEnd: expect.any(Boolean), isPublic: expect.any(Boolean), skip: expect.any(Boolean), revision: expect.any(Number), @@ -775,7 +775,7 @@ describe('getCustomFieldData()', () => { duration: 'duration', cue: 'cue', title: 'title', - isTimeToEnd: 'time to end', + countToEnd: 'count to end', isPublic: 'public', skip: 'skip', note: 'notes', @@ -826,7 +826,7 @@ describe('getCustomFieldData()', () => { duration: 'duration', cue: 'cue', title: 'title', - isTimeToEnd: 'time to end', + countToEnd: 'count to end', isPublic: 'public', skip: 'skip', note: 'notes', @@ -886,7 +886,7 @@ describe('parseExcel()', () => { 'Title', 'End Action', 'Timer type', - 'Time to end', + 'Count to end', 'Public', 'Skip', 'Notes', @@ -909,7 +909,7 @@ describe('parseExcel()', () => { 'Guest Welcome', '', '', - 'x', // <-- time to end + 'x', // <-- count to end 'x', // <-- public '', 'Ballyhoo', @@ -932,7 +932,7 @@ describe('parseExcel()', () => { 'A song from the hearth', 'load-next', 'clock', - 'x', // <-- time to end + 'x', // <-- count to end '', // <-- public 'x', 'Rainbow chase', @@ -977,7 +977,7 @@ describe('parseExcel()', () => { timerType: 'count-down', endAction: 'none', isPublic: true, - isTimeToEnd: true, + countToEnd: true, skip: false, note: 'Ballyhoo', custom: { @@ -1001,7 +1001,7 @@ describe('parseExcel()', () => { timeEnd: 30600000, title: 'A song from the hearth', timerType: 'clock', - isTimeToEnd: true, + countToEnd: true, endAction: 'load-next', isPublic: false, skip: true, diff --git a/apps/server/src/utils/__tests__/parserFunctions.test.ts b/apps/server/src/utils/__tests__/parserFunctions.test.ts index 7a6e03824..12d69454e 100644 --- a/apps/server/src/utils/__tests__/parserFunctions.test.ts +++ b/apps/server/src/utils/__tests__/parserFunctions.test.ts @@ -532,7 +532,7 @@ describe('parseRundown() migrations', () => { expect(result.rundown[0]).toMatchObject({ id: '1', timerType: TimerType.CountDown, - isTimeToEnd: true, + countToEnd: true, }); }); @@ -542,7 +542,7 @@ describe('parseRundown() migrations', () => { expect(result.rundown[0]).toMatchObject({ id: '1', timerType: TimerType.CountDown, - isTimeToEnd: false, + countToEnd: false, }); }); }); diff --git a/apps/server/src/utils/parser.ts b/apps/server/src/utils/parser.ts index f8b7ae278..102230f4e 100644 --- a/apps/server/src/utils/parser.ts +++ b/apps/server/src/utils/parser.ts @@ -110,7 +110,7 @@ export const parseExcel = ( // options: booleans let isPublicIndex: number | null = null; let skipIndex: number | null = null; - let isTimeToEndIndex: number | null = null; + let countToEndIndex: number | null = null; let linkStartIndex: number | null = null; @@ -160,9 +160,9 @@ export const parseExcel = ( titleIndex = col; rundownMetadata['title'] = { row, col }; }, - [importMap.isTimeToEnd]: (row: number, col: number) => { - isTimeToEndIndex = col; - rundownMetadata['isTimeToEnd'] = { row, col }; + [importMap.countToEnd]: (row: number, col: number) => { + countToEndIndex = col; + rundownMetadata['countToEnd'] = { row, col }; }, [importMap.isPublic]: (row: number, col: number) => { isPublicIndex = col; @@ -231,8 +231,8 @@ export const parseExcel = ( event.duration = parseExcelDate(column); } else if (j === cueIndex) { event.cue = makeString(column, ''); - } else if (j === isTimeToEndIndex) { - event.isTimeToEnd = parseBooleanString(column); + } else if (j === countToEndIndex) { + event.countToEnd = parseBooleanString(column); } else if (j === isPublicIndex) { event.isPublic = parseBooleanString(column); } else if (j === skipIndex) { @@ -379,7 +379,7 @@ export function createPatch(originalEvent: OntimeEvent, patchEvent: Partial { duration: 'duration', cue: 'cue', title: 'title', - isTimeToEnd: 'time to end', + countToEnd: 'count to end', isPublic: 'public', skip: 'skip', note: 'notes', @@ -35,7 +35,7 @@ describe('isImportMap()', () => { duration: 'duration', cue: 'cue', title: 'title', - isTimeToEnd: 'time to end', + countToEnd: 'count to end', isPublic: 'public', skip: 'skip', note: 'notes', diff --git a/packages/utils/src/feature/spreadsheet-import/spreadsheetImport.ts b/packages/utils/src/feature/spreadsheet-import/spreadsheetImport.ts index 830b805e5..3ac82f10a 100644 --- a/packages/utils/src/feature/spreadsheet-import/spreadsheetImport.ts +++ b/packages/utils/src/feature/spreadsheet-import/spreadsheetImport.ts @@ -11,7 +11,7 @@ export const defaultImportMap = { duration: 'duration', cue: 'cue', title: 'title', - isTimeToEnd: 'time to end', + countToEnd: 'count to end', isPublic: 'public', skip: 'skip', note: 'notes',