style: cleanup to excel import

This commit is contained in:
Carlos Valente
2025-06-28 08:11:40 +02:00
committed by Carlos Valente
parent 310dde4465
commit b66eac3c9f
2 changed files with 4 additions and 3 deletions
@@ -176,6 +176,7 @@ export const parseExcel = (
if (maybeTimeType === 'block') {
// we leave this as a clue for the object filtering later on
entry.type = SupportedEntry.Block;
entry.entries = [];
} else if (maybeTimeType === '' || maybeTimeType === 'event' || isKnownTimerType(maybeTimeType)) {
// @ts-expect-error -- we leave this as a clue for the object filtering later on
entry.type = SupportedEntry.Event;
@@ -50,13 +50,13 @@ export function generateRundownPreview(options: ImportMap): { rundown: Rundown;
const parsedCustomFields = parseCustomFields(dataFromExcel);
// we run the parsed data through an extra step to ensure the objects shape
const Rundown = parseRundown(dataFromExcel.rundown, parsedCustomFields);
if (Rundown.order.length === 0) {
const rundown = parseRundown(dataFromExcel.rundown, parsedCustomFields);
if (rundown.order.length === 0) {
throw new Error(`Could not find data to import in the worksheet: ${options.worksheet}`);
}
// clear the data
excelData = xlsx.utils.book_new();
return { rundown: Rundown, customFields: parsedCustomFields };
return { rundown, customFields: parsedCustomFields };
}