diff --git a/frontend/src/lib/convertAnswerData.ts b/frontend/src/lib/convertAnswerData.ts new file mode 100644 index 0000000..280ed62 --- /dev/null +++ b/frontend/src/lib/convertAnswerData.ts @@ -0,0 +1,27 @@ +export const convertAnswerData = (value: string): number => { + let result = 0; + + switch (value) { + case "Veldig dårlig": + result = 1; + break; + case "Dårlig": + result = 2; + break; + case "Nøytral": + result = 3; + break; + case "Bra": + result = 4; + break; + case "Veldig Bra": + result = 5; + break; + default: + console.log("Wrong input"); + result = 0; + break; + } + + return result; +};