Skip to content

Commit

Permalink
Merge pull request #25 from VPatient/lifeActivityFormsUpdate
Browse files Browse the repository at this point in the history
re-recorrected return format
  • Loading branch information
Tzesh committed Mar 30, 2023
2 parents e13a4f8 + b93c0ae commit f0b5fdd
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions routes/patient/lifeactivity/lifeactivity.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,23 @@ router.get("", auth, verifyPatient, async(req, res) => {
return {
"form_title": form.name,
"form_sequence": form.sequence,
"data": questions.filter(question => question.form.toString() === form._id.toString()).map(question => {
return {
"question": {
"question_id": question._id,
"fields": question.fields,
"correct_answer": records.find(record => record.question.toString() === question._id.toString()).correct_answer,
"title": question.title,
"description": "",
"type": question.type,
"remark": question.remark,
"is_mandatory": question.is_mandatory,
"show_answer": question.show_answer
}
}
})
"data": [{
"questions": [
questions.filter(question => question.form.toString() === form._id.toString()).map(question => {
return {
"question_id": question._id,
"fields": question.fields,
"correct_answer": records.find(record => record.question.toString() === question._id.toString()).correct_answer,
"title": question.title,
"description": "",
"type": question.type,
"remark": question.remark,
"is_mandatory": question.is_mandatory,
"show_answer": question.show_answer
}
})
]
}]
}
});

Expand Down

0 comments on commit f0b5fdd

Please sign in to comment.