mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-24 00:19:21 +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') {
|
if (maybeTimeType === 'block') {
|
||||||
// we leave this as a clue for the object filtering later on
|
// we leave this as a clue for the object filtering later on
|
||||||
entry.type = SupportedEntry.Block;
|
entry.type = SupportedEntry.Block;
|
||||||
|
entry.entries = [];
|
||||||
} else if (maybeTimeType === '' || maybeTimeType === 'event' || isKnownTimerType(maybeTimeType)) {
|
} else if (maybeTimeType === '' || maybeTimeType === 'event' || isKnownTimerType(maybeTimeType)) {
|
||||||
// @ts-expect-error -- we leave this as a clue for the object filtering later on
|
// @ts-expect-error -- we leave this as a clue for the object filtering later on
|
||||||
entry.type = SupportedEntry.Event;
|
entry.type = SupportedEntry.Event;
|
||||||
|
|||||||
@@ -50,13 +50,13 @@ export function generateRundownPreview(options: ImportMap): { rundown: Rundown;
|
|||||||
const parsedCustomFields = parseCustomFields(dataFromExcel);
|
const parsedCustomFields = parseCustomFields(dataFromExcel);
|
||||||
|
|
||||||
// we run the parsed data through an extra step to ensure the objects shape
|
// we run the parsed data through an extra step to ensure the objects shape
|
||||||
const Rundown = parseRundown(dataFromExcel.rundown, parsedCustomFields);
|
const rundown = parseRundown(dataFromExcel.rundown, parsedCustomFields);
|
||||||
if (Rundown.order.length === 0) {
|
if (rundown.order.length === 0) {
|
||||||
throw new Error(`Could not find data to import in the worksheet: ${options.worksheet}`);
|
throw new Error(`Could not find data to import in the worksheet: ${options.worksheet}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear the data
|
// clear the data
|
||||||
excelData = xlsx.utils.book_new();
|
excelData = xlsx.utils.book_new();
|
||||||
|
|
||||||
return { rundown: Rundown, customFields: parsedCustomFields };
|
return { rundown, customFields: parsedCustomFields };
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user