✨ convert answer data to string
Co-authored-by: Sindre Kjelsrud <kjelsrudsindre@gmail.com>
This commit is contained in:
parent
5467a3fb8c
commit
d92c45ecfc
1 changed files with 29 additions and 2 deletions
|
@ -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;
|
||||
};
|
||||
|
|
Reference in a new issue