refactor: generate ids for new rundowns

This commit is contained in:
Carlos Valente
2025-12-11 18:22:28 +01:00
committed by Carlos Valente
parent b70ef80320
commit f2b78e0f32
13 changed files with 146 additions and 73 deletions
@@ -19,8 +19,8 @@ import {
} from 'ontime-types';
import { isObjectEmpty, generateId, getLinkedTimes, getTimeFrom, isNewLatest } from 'ontime-utils';
import { defaultRundown } from '../../models/dataModel.js';
import { delay as delayDef } from '../../models/eventsDefinition.js';
import { makeNewRundown } from '../../models/dataModel.js';
import type { ErrorEmitter } from '../../utils/parserUtils.js';
import { calculateDayOffset, cleanupCustomFields, createGroup, createEvent, createMilestone } from './rundown.utils.js';
@@ -39,10 +39,9 @@ export function parseRundowns(
// this is important since the rest of the app assumes this exist
if (!data.rundowns || isObjectEmpty(data.rundowns)) {
emitError?.('No data found to import');
const defaultRundown = makeNewRundown();
return {
[defaultRundown.id]: {
...defaultRundown,
},
[defaultRundown.id]: defaultRundown,
};
}