add endAction and timerType validation to excel upload (#401)

* add endAction and timerType validation to excel upload

* return parser tests + add tests for the excel fields
This commit is contained in:
Olayinka Zadat O
2023-05-20 20:19:42 +01:00
committed by GitHub
parent bd6e737ec6
commit 2f26c28c23
3 changed files with 946 additions and 0 deletions
+12
View File
@@ -54,6 +54,8 @@ export const parseExcel = async (excelData) => {
let user7Index: number | null = null;
let user8Index: number | null = null;
let user9Index: number | null = null;
let endActionIndex: number | null = null;
let timerTypeIndex: number | null = null;
excelData
.filter((e) => e.length > 0)
@@ -103,6 +105,10 @@ export const parseExcel = async (excelData) => {
event.skip = Boolean(column);
} else if (j === notesIndex) {
event.note = column;
} else if (j === endActionIndex) {
event.endAction = column;
} else if (j === timerTypeIndex) {
event.timerType = column;
} else if (j === colourIndex) {
event.colour = column;
} else if (j === user0Index) {
@@ -188,6 +194,12 @@ export const parseExcel = async (excelData) => {
case 'color':
colourIndex = j;
break;
case 'end action':
endActionIndex = j;
break;
case 'timer type':
timerTypeIndex = j;
break;
default:
// look for user defined
if (col.startsWith('user')) {