diff --git a/apps/server/src/api-data/excel/__tests__/excel.parser.test.ts b/apps/server/src/api-data/excel/__tests__/excel.parser.test.ts index 35251abcd..0cf11ae88 100644 --- a/apps/server/src/api-data/excel/__tests__/excel.parser.test.ts +++ b/apps/server/src/api-data/excel/__tests__/excel.parser.test.ts @@ -13,21 +13,27 @@ describe('parseExcel()', () => { expect(result.rundown.flatOrder.length).toBe(14); expect(result.rundown.order.length).toBe(4); - const firstEvent = result.rundown.entries[result.rundown.flatOrder[2]]; + const firstEventId = result.rundown.flatOrder[2]; + const firstEvent = result.rundown.entries[firstEventId]; expect(firstEvent).toMatchObject({ + id: firstEventId, type: SupportedEntry.Event, title: 'Pre-show Countdown', }); expect(millisToString((firstEvent as OntimeEvent).timeStart)).toBe('10:00:00'); - const lastEvent = result.rundown.entries[result.rundown.flatOrder[12]]; + const lastEventId = result.rundown.flatOrder[12]; + const lastEvent = result.rundown.entries[lastEventId]; expect(lastEvent).toMatchObject({ + id: lastEventId, type: SupportedEntry.Event, title: 'Wrap up', }); + // the excel step does not relate elements yet expect(millisToString((lastEvent as OntimeEvent).timeEnd)).toBe('00:00:00'); }); + it('parses an import map with only custom fields', () => { // partial import map with only custom fields const importMap = { diff --git a/apps/server/src/api-data/excel/excel.parser.ts b/apps/server/src/api-data/excel/excel.parser.ts index e85d770e1..52c978cad 100644 --- a/apps/server/src/api-data/excel/excel.parser.ts +++ b/apps/server/src/api-data/excel/excel.parser.ts @@ -184,6 +184,7 @@ export const parseExcel = ( // from excel, we can only get groups, milestones and events if (isOntimeGroup(entry as OntimeEntry)) { const group = { + id, // will be replaced by a potentially user given ID ...entry, targetDuration: entry.duration ? entry.duration : null, custom: { ...entryCustomFields }, @@ -200,7 +201,11 @@ export const parseExcel = ( } if (isOntimeMilestone(entry as OntimeEntry)) { - const milestone = { ...entry, custom: { ...entryCustomFields } } as OntimeMilestone; + const milestone = { + id, // will be replaced by a potentially user given ID + ...entry, + custom: { ...entryCustomFields }, + } as OntimeMilestone; if (currentGroupId) { groupEntries.push(id); milestone.parent = currentGroupId; @@ -214,6 +219,7 @@ export const parseExcel = ( // after group and milestones we only have events remaining const event = { + id, // will be replaced by a potentially user given ID ...entry, custom: { ...entryCustomFields }, type: SupportedEntry.Event,