✨ function to convert formdata
Co-authored-by: Sindre Kjelsrud <kjelsrudsindre@gmail.com>
This commit is contained in:
parent
778910ac69
commit
568d9261a7
1 changed files with 27 additions and 0 deletions
27
frontend/src/lib/convertAnswerData.ts
Normal file
27
frontend/src/lib/convertAnswerData.ts
Normal 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;
|
||||
};
|
Reference in a new issue