mirror of
https://github.com/cpvalente/ontime.git
synced 2026-09-05 22:39:11 +00:00
feat: count to group completion
This commit is contained in:
@@ -34,7 +34,14 @@ export {
|
||||
group as groupDef,
|
||||
milestone as milestoneDef,
|
||||
} from './src/rundown-utils/entryDefinitions.js';
|
||||
export { createDelay, createEvent, createGroup, createMilestone, makeString } from './src/rundown-utils/entryUtils.js';
|
||||
export {
|
||||
createDelay,
|
||||
createEvent,
|
||||
createGroup,
|
||||
createMilestone,
|
||||
makeString,
|
||||
validateGroupTimerType,
|
||||
} from './src/rundown-utils/entryUtils.js';
|
||||
|
||||
// time format utils
|
||||
export {
|
||||
|
||||
@@ -52,6 +52,8 @@ export const group: Omit<OntimeGroup, 'id'> = {
|
||||
note: '',
|
||||
entries: [],
|
||||
targetDuration: null,
|
||||
useGroupTimer: false,
|
||||
timerType: TimerType.CountDown,
|
||||
colour: '',
|
||||
custom: {},
|
||||
// !==== RUNTIME METADATA ====! //
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { OntimeDelay, OntimeEvent, OntimeGroup, OntimeMilestone } from 'ontime-types';
|
||||
import { SupportedEntry, TimeStrategy } from 'ontime-types';
|
||||
import { SupportedEntry, TimeStrategy, TimerType } from 'ontime-types';
|
||||
|
||||
import { generateId } from '../generate-id/generateId.js';
|
||||
import { validateEndAction, validateTimerType } from '../validate-events/validateEvent.js';
|
||||
@@ -67,6 +67,8 @@ export function createGroup(patch?: Partial<OntimeGroup>): OntimeGroup {
|
||||
note: patch.note ?? '',
|
||||
entries: patch.entries ?? [],
|
||||
targetDuration: patch.targetDuration ?? null,
|
||||
useGroupTimer: patch.useGroupTimer === true,
|
||||
timerType: validateGroupTimerType(patch.timerType),
|
||||
colour: makeString(patch.colour, ''),
|
||||
custom: patch.custom ?? {},
|
||||
revision: 0,
|
||||
@@ -77,6 +79,16 @@ export function createGroup(patch?: Partial<OntimeGroup>): OntimeGroup {
|
||||
};
|
||||
}
|
||||
|
||||
export function validateGroupTimerType(
|
||||
value: unknown,
|
||||
fallback: unknown = TimerType.CountDown,
|
||||
): TimerType.CountDown | TimerType.CountUp {
|
||||
if (value === TimerType.CountDown || value === TimerType.CountUp) {
|
||||
return value;
|
||||
}
|
||||
return fallback === TimerType.CountUp ? TimerType.CountUp : TimerType.CountDown;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new milestone from an optional patch
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user