Commit 4471bcfe authored by Christopher Mark Fullarton's avatar Christopher Mark Fullarton
Browse files

Fixes invalid type of questions

parent f8eb2c5e
...@@ -276,8 +276,10 @@ class QuizDAO extends AbstractDAO<Array<IQuizEntity>> { ...@@ -276,8 +276,10 @@ class QuizDAO extends AbstractDAO<Array<IQuizEntity>> {
} }
}); });
obj.TYPE = obj.type; if (obj.hasOwnProperty('type')) {
delete obj.type; obj.TYPE = obj.type;
delete obj.type;
}
return obj; return obj;
} }
......
...@@ -10,6 +10,6 @@ export const getAnswerForType = (type: AnswerType, data?: object): AbstractAnswe ...@@ -10,6 +10,6 @@ export const getAnswerForType = (type: AnswerType, data?: object): AbstractAnswe
case AnswerType.FreeTextAnswerOption: case AnswerType.FreeTextAnswerOption:
return new FreeTextAnswerEntity(data); return new FreeTextAnswerEntity(data);
default: 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 ...@@ -28,6 +28,6 @@ export const getQuestionForType = (type: QuestionType | string, data = {}): Abst
case QuestionType.SurveyQuestion: case QuestionType.SurveyQuestion:
return new SurveyQuestionEntity(data); return new SurveyQuestionEntity(data);
default: 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