convert answer data to string

Co-authored-by: Sindre Kjelsrud <kjelsrudsindre@gmail.com>
This commit is contained in:
haraldnilsen 2024-01-07 14:58:47 +01:00
parent 5467a3fb8c
commit d92c45ecfc

View file

@ -1,4 +1,4 @@
export const convertAnswerData = (value: string): number => {
export const convertAnswerDataToNumeric = (value: string): number => {
let result = 0;
switch (value) {
@ -14,7 +14,7 @@ export const convertAnswerData = (value: string): number => {
case "Bra":
result = 4;
break;
case "Veldig Bra":
case "Veldig bra":
result = 5;
break;
default:
@ -25,3 +25,30 @@ export const convertAnswerData = (value: string): number => {
return result;
};
export const convertAnswerDataToString = (value: number): string => {
let result = "";
switch (value) {
case 1:
result = "Veldig dårlig";
break;
case 2:
result = "Dårlig";
break;
case 3:
result = "Nøytral";
break;
case 4:
result = "Bra";
break;
case 5:
result = "Veldig bra";
break;
default:
console.log("Wrong input");
break;
}
return result;
};