function to convert formdata

Co-authored-by: Sindre Kjelsrud <kjelsrudsindre@gmail.com>
This commit is contained in:
haraldnilsen 2024-01-07 13:57:26 +01:00
parent 778910ac69
commit 568d9261a7

View file

@ -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;
};