refactor: clarify description import (#526)

This commit is contained in:
Carlos Valente
2023-09-16 15:24:23 +02:00
committed by GitHub
parent 958c68b6f6
commit 7545f6f7d0
+8 -7
View File
@@ -70,8 +70,9 @@ export const parseExcel = async (excelData) => {
excelData excelData
.filter((e) => e.length > 0) .filter((e) => e.length > 0)
.forEach((row) => { .forEach((row) => {
let eventTitleNext = false; // project data imports are on the column to the right
let projectTitleNext = false; let projectTitleNext = false;
let projectDescriptionNext = false;
let publicUrlNext = false; let publicUrlNext = false;
let publicInfoNext = false; let publicInfoNext = false;
let backstageUrlNext = false; let backstageUrlNext = false;
@@ -81,12 +82,12 @@ export const parseExcel = async (excelData) => {
row.forEach((column, j) => { row.forEach((column, j) => {
// check flags // check flags
if (eventTitleNext) { if (projectTitleNext) {
projectData.title = column; projectData.title = column;
eventTitleNext = false;
} else if (projectTitleNext) {
projectData.description = column;
projectTitleNext = false; projectTitleNext = false;
} else if (projectDescriptionNext) {
projectData.description = column;
projectDescriptionNext = false;
} else if (publicUrlNext) { } else if (publicUrlNext) {
projectData.publicUrl = column; projectData.publicUrl = column;
publicUrlNext = false; publicUrlNext = false;
@@ -159,10 +160,10 @@ export const parseExcel = async (excelData) => {
// need to make sure it is a string first // need to make sure it is a string first
switch (col) { switch (col) {
case 'project name': case 'project name':
eventTitleNext = true; projectTitleNext = true;
break; break;
case 'project description': case 'project description':
projectTitleNext = true; projectDescriptionNext = true;
break; break;
case 'public url': case 'public url':
publicUrlNext = true; publicUrlNext = true;