mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-10 18:03:47 +00:00
Link start times from excel import (#903)
* add test for linking start time in excel import * link ids * add link to UI * ensure times with cachedRundown --------- Co-authored-by: Carlos Valente <carlosvalente@pm.me>
This commit is contained in:
committed by
GitHub
parent
d8a8f0ad92
commit
74418ce17e
@@ -18,7 +18,7 @@ import {
|
||||
isOntimeDelay,
|
||||
isOntimeEvent,
|
||||
} from 'ontime-types';
|
||||
import { generateId } from 'ontime-utils';
|
||||
import { generateId, getLastEvent } from 'ontime-utils';
|
||||
|
||||
import { dbModel } from '../models/dataModel.js';
|
||||
import { block as blockDef, delay as delayDef } from '../models/eventsDefinition.js';
|
||||
@@ -48,11 +48,16 @@ export const parseRundown = (data: Partial<DatabaseModel>): OntimeRundown => {
|
||||
let newEvent: OntimeEvent | OntimeDelay | OntimeBlock | null;
|
||||
|
||||
if (isOntimeEvent(event)) {
|
||||
if (event.linkStart) {
|
||||
const prevEvent = getLastEvent(rundown).lastEvent;
|
||||
event.linkStart = prevEvent.id;
|
||||
}
|
||||
newEvent = createEvent(event, eventIndex.toString());
|
||||
// skip if event is invalid
|
||||
if (newEvent == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
eventIndex += 1;
|
||||
} else if (isOntimeDelay(event)) {
|
||||
newEvent = { ...delayDef, duration: event.duration, id };
|
||||
|
||||
Reference in New Issue
Block a user