Fixes invalid type of questions

parent f8eb2c5e
......@@ -276,8 +276,10 @@ class QuizDAO extends AbstractDAO<Array<IQuizEntity>> {
}
});
obj.TYPE = obj.type;
delete obj.type;
if (obj.hasOwnProperty('type')) {
obj.TYPE = obj.type;
delete obj.type;
}
return obj;
}
......
......@@ -10,6 +10,6 @@ export const getAnswerForType = (type: AnswerType, data?: object): AbstractAnswe
case AnswerType.FreeTextAnswerOption:
return new FreeTextAnswerEntity(data);
default:
throw new Error(`Cannot built question with type: ${type}`);
throw new Error(`Cannot build answer with type: ${type}`);
}
};
......@@ -28,6 +28,6 @@ export const getQuestionForType = (type: QuestionType | string, data = {}): Abst
case QuestionType.SurveyQuestion:
return new SurveyQuestionEntity(data);
default:
throw new Error(`Cannot built question with type: ${type}`);
throw new Error(`Cannot build question with type: ${type}`);
}
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment