mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-11 02:13:48 +00:00
style: cleanup to excel import
This commit is contained in:
committed by
Carlos Valente
parent
310dde4465
commit
b66eac3c9f
@@ -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 };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user