tango-app-api-trax 3.3.1-beta-4 → 3.3.1-beta-5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-app-api-trax",
3
- "version": "3.3.1-beta-4",
3
+ "version": "3.3.1-beta-5",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -247,6 +247,10 @@ export async function startChecklist( req, res ) {
247
247
  questions.push( question );
248
248
  let linkedAnswer = new Set( question.answers.filter( ( ele ) => ele.showLinked ).flatMap( ( ele ) => ele.nestedQuestion ) );
249
249
  let linkedQuestion = section.questions.filter( ( qn ) => linkedAnswer.has( qn.qno ) );
250
+ linkedQuestion = JSON.parse( JSON.stringify( linkedQuestion ) );
251
+ linkedQuestion.forEach( ( linkQn ) => {
252
+ linkQn.parentQuestion = question.qno;
253
+ } );
250
254
  questions.push( ...linkedQuestion );
251
255
  }
252
256
  }
@@ -1079,6 +1083,7 @@ export async function sopMobilechecklistMultiSectionFormatterv1( req, res, next
1079
1083
  structure.parentanswer = requestSection[i].parentanswer;
1080
1084
  structure.questionReferenceImage = qaAnswers[j].questionReferenceImage;
1081
1085
  structure.descriptivetype = qaAnswers[j].descriptivetype;
1086
+ structure.parentQuestion = requestSection[i]?.parentQuestion || qaAnswers[j].qno;
1082
1087
  if ( qaAnswers[j]?.taskId ) {
1083
1088
  structure.taskId = qaAnswers[j]?.taskId;
1084
1089
  structure.task = true;
@@ -1130,6 +1135,7 @@ export async function sopMobilechecklistMultiSectionFormatterv1( req, res, next
1130
1135
  structure.parentanswer = requestSection[i].parentanswer;
1131
1136
  structure.questionReferenceImage = qaAnswers[j].questionReferenceImage;
1132
1137
  structure.descriptivetype = qaAnswers[j].descriptivetype;
1138
+ structure.parentQuestion = requestSection[i]?.parentQuestion || qaAnswers[j].qno;
1133
1139
  if ( qaAnswers[j]?.taskId ) {
1134
1140
  structure.taskId = qaAnswers[j]?.taskId;
1135
1141
  structure.task = true;
@@ -1185,6 +1191,7 @@ export async function sopMobilechecklistMultiSectionFormatterv1( req, res, next
1185
1191
  structure.parentanswer = requestSection[i].parentanswer;
1186
1192
  structure.questionReferenceImage = qaAnswers[j].questionReferenceImage;
1187
1193
  structure.descriptivetype = qaAnswers[j].descriptivetype;
1194
+ structure.parentQuestion = requestSection[i]?.parentQuestion || qaAnswers[j].qno;
1188
1195
  if ( qaAnswers[j]?.taskId ) {
1189
1196
  structure.taskId = qaAnswers[j]?.taskId;
1190
1197
  structure.task = true;
@@ -1245,6 +1252,7 @@ export async function sopMobilechecklistMultiSectionFormatterv1( req, res, next
1245
1252
  structure.parentanswer = requestSection[i].parentanswer;
1246
1253
  structure.questionReferenceImage = qaAnswers[j].questionReferenceImage;
1247
1254
  structure.descriptivetype = qaAnswers[j].descriptivetype;
1255
+ structure.parentQuestion = requestSection[i]?.parentQuestion || qaAnswers[j].qno;
1248
1256
  if ( qaAnswers[j]?.taskId ) {
1249
1257
  structure.taskId = qaAnswers[j]?.taskId;
1250
1258
  structure.task = true;
@@ -1303,6 +1311,7 @@ export async function sopMobilechecklistMultiSectionFormatterv1( req, res, next
1303
1311
  structure.parentanswer = requestSection[i].parentanswer;
1304
1312
  structure.questionReferenceImage = qaAnswers[j].questionReferenceImage;
1305
1313
  structure.descriptivetype = qaAnswers[j].descriptivetype;
1314
+ structure.parentQuestion = requestSection[i]?.parentQuestion || qaAnswers[j].qno;
1306
1315
  if ( qaAnswers[j]?.taskId ) {
1307
1316
  structure.taskId = qaAnswers[j]?.taskId;
1308
1317
  structure.task = true;
@@ -2586,7 +2595,11 @@ export async function questionList( req, res ) {
2586
2595
  if ( !question.linkType ) {
2587
2596
  questions.push( question );
2588
2597
  let linkedAnswer = new Set( question.answers.filter( ( ele ) => ele.showLinked ).flatMap( ( ele ) => ele.nestedQuestion ) );
2589
- let linkedQuestion = section.questions.filter( ( qn ) => linkedAnswer.has( qn.qno ) );
2598
+ let linkedQuestion = section.questions.filter( ( qn ) => qn?.parentQuestion ? qn?.parentQuestion == question.qno && linkedAnswer.has( qn.qno ) : linkedAnswer.has( qn.qno ) );
2599
+ linkedQuestion = JSON.parse( JSON.stringify( linkedQuestion ) );
2600
+ linkedQuestion.forEach( ( linkQn ) => {
2601
+ linkQn.parentQuestion = question.qno;
2602
+ } );
2590
2603
  questions.push( ...linkedQuestion );
2591
2604
  }
2592
2605
  }