skydiet-lib-node
Advanced tools
Comparing version 1.0.52 to 1.0.53
@@ -163,5 +163,8 @@ "use strict"; | ||
const answerv2 = (questionAnswered, bankQuestions, attendanceMetActivities) => { | ||
const question = bankQuestions.find((q) => q._id === questionAnswered._id); | ||
if (!question) { | ||
throw new Error("invalid question"); | ||
const question = questionAnswered; | ||
if (questionAnswered._id) { | ||
const question = bankQuestions.find((q) => q._id === questionAnswered._id); | ||
if (!question) { | ||
throw new Error("invalid question"); | ||
} | ||
} | ||
@@ -168,0 +171,0 @@ if (question.typeQuestion === IQuestion_1.TYPE_QUESTION.NO_AUTO_ANSWER) { |
{ | ||
"name": "skydiet-lib-node", | ||
"version": "1.0.52", | ||
"version": "1.0.53", | ||
"description": "Biblioteca para funções skydiet", | ||
@@ -5,0 +5,0 @@ "author": "Daniel Cabral <cabralconsultoriaemsoftware@gmail.com>", |
@@ -144,3 +144,3 @@ import { isEmpty, isNotEmpty } from "c2-util-front"; | ||
} | ||
aq.childs = items.filter((item: IAttendanceQuestion) => item.category.includes(category) && item.questionOrigin && item.questionParent === aq.questionOrigin) | ||
@@ -185,5 +185,10 @@ }) | ||
export const answerv2 = (questionAnswered: IAttendanceQuestion, bankQuestions: IAttendanceQuestion[], attendanceMetActivities: IAttendanceMetActivity[]): { questions: IAttendanceQuestion[], autoAnswers: IAttendanceQuestion[] } => { | ||
const question = bankQuestions.find((q: IAttendanceQuestion) => q._id === questionAnswered._id) | ||
if (!question) { | ||
throw new Error("invalid question") | ||
const question = questionAnswered; | ||
if (questionAnswered._id) { | ||
const question = bankQuestions.find((q) => q._id === questionAnswered._id); | ||
if (!question) { | ||
throw new Error("invalid question"); | ||
} | ||
} | ||
@@ -190,0 +195,0 @@ |
105212
2351