tango-app-api-trax 3.3.1-beta-1 → 3.3.1-beta-2
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
|
@@ -220,30 +220,35 @@ export async function startChecklist( req, res ) {
|
|
|
220
220
|
|
|
221
221
|
let getchecklist = getupdatedchecklist;
|
|
222
222
|
let questions = [];
|
|
223
|
-
function processQuestion( question, section, questions, nested=false ) {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
}
|
|
223
|
+
// function processQuestion( question, section, questions, nested=false ) {
|
|
224
|
+
// let findExists = questions.find( ( item ) => item?.qno && item.qno == question.qno );
|
|
225
|
+
// if ( findExists && nested ) {
|
|
226
|
+
// let findIndex = questions.findIndex( ( item ) => item?.qno && item.qno == question.qno );
|
|
227
|
+
// questions.splice( findIndex, 1 );
|
|
228
|
+
// questions.push( question );
|
|
229
|
+
// }
|
|
230
|
+
// if ( !findExists ) {
|
|
231
|
+
// questions.push( question );
|
|
232
|
+
// for ( let answer of question.answers ) {
|
|
233
|
+
// if ( answer.showLinked && answer?.linkedQuestion != '' ) {
|
|
234
|
+
// let linkedQuestion = section.questions.find( ( item ) => item.qno == answer.linkedQuestion );
|
|
235
|
+
// if ( linkedQuestion ) {
|
|
236
|
+
// processQuestion( linkedQuestion, section, questions, true );
|
|
237
|
+
// }
|
|
238
|
+
// }
|
|
239
|
+
// }
|
|
240
|
+
// }
|
|
241
|
+
// }
|
|
242
242
|
for ( let [ index, data ] of getchecklist.entries() ) {
|
|
243
243
|
for ( let [ secIndex, section ] of data.questionAnswers.entries() ) {
|
|
244
244
|
questions = [];
|
|
245
245
|
for ( let question of section.questions ) {
|
|
246
|
-
|
|
246
|
+
if ( !question.linkType ) {
|
|
247
|
+
questions.push( question );
|
|
248
|
+
let linkedAnswer = new Set( question.answers.filter( ( ele ) => ele.showLinked ).flatMap( ( ele ) => ele.nestedQuestion ) );
|
|
249
|
+
let linkedQuestion = section.questions.filter( ( qn ) => linkedAnswer.has( qn.qno ) );
|
|
250
|
+
questions.push( ...linkedQuestion );
|
|
251
|
+
}
|
|
247
252
|
}
|
|
248
253
|
getchecklist[index].questionAnswers[secIndex].questions = questions;
|
|
249
254
|
}
|
|
@@ -2480,7 +2485,11 @@ export async function questionList( req, res ) {
|
|
|
2480
2485
|
if ( question.answerType == 'multiplechoicemultiple' ) {
|
|
2481
2486
|
let checkvalidation = null;
|
|
2482
2487
|
if ( answer.validationAnswer && answer.validationAnswer !='' ) {
|
|
2483
|
-
|
|
2488
|
+
if ( answer.validationType != 'Descriptive Answer' ) {
|
|
2489
|
+
checkvalidation = await signedUrl( { file_path: decodeURIComponent( answer.validationAnswer ), Bucket: bucket.sop } );
|
|
2490
|
+
} else {
|
|
2491
|
+
checkvalidation = answer.validationAnswer;
|
|
2492
|
+
}
|
|
2484
2493
|
}
|
|
2485
2494
|
Multianswer.push( { 'answer': answer.answer, 'no': ansIndex, 'validationAnswer': checkvalidation } );
|
|
2486
2495
|
getchecklist[0].questionAnswers[secIndex].questions[questionIndex].answers[ansIndex].index = ansIndex;
|
|
@@ -2543,38 +2552,43 @@ export async function questionList( req, res ) {
|
|
|
2543
2552
|
}
|
|
2544
2553
|
|
|
2545
2554
|
let questions = [];
|
|
2546
|
-
function processQuestion( question, section, questions, nested=false ) {
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
}
|
|
2555
|
+
// function processQuestion( question, section, questions, nested=false ) {
|
|
2556
|
+
// let findExists = questions.find( ( item ) => item?.qno && item.qno == question.qno );
|
|
2557
|
+
// if ( findExists && nested ) {
|
|
2558
|
+
// // let findIndex = questions.findIndex( ( item ) => item?.qno && item.qno == question.qno );
|
|
2559
|
+
// // questions.splice( findIndex, 1 );
|
|
2560
|
+
// questions.push( question );
|
|
2561
|
+
// for ( let answer of question.answers ) {
|
|
2562
|
+
// if ( answer.showLinked && answer?.linkedQuestion != '' ) {
|
|
2563
|
+
// let linkedQuestion = section.questions.find( ( item ) => item.qno == answer.linkedQuestion );
|
|
2564
|
+
// if ( linkedQuestion ) {
|
|
2565
|
+
// processQuestion( linkedQuestion, section, questions, true );
|
|
2566
|
+
// }
|
|
2567
|
+
// }
|
|
2568
|
+
// }
|
|
2569
|
+
// }
|
|
2570
|
+
// if ( !findExists ) {
|
|
2571
|
+
// questions.push( question );
|
|
2572
|
+
// for ( let answer of question.answers ) {
|
|
2573
|
+
// if ( answer.showLinked && answer?.linkedQuestion != '' ) {
|
|
2574
|
+
// let linkedQuestion = section.questions.find( ( item ) => item.qno == answer.linkedQuestion );
|
|
2575
|
+
// if ( linkedQuestion ) {
|
|
2576
|
+
// processQuestion( linkedQuestion, section, questions, true );
|
|
2577
|
+
// }
|
|
2578
|
+
// }
|
|
2579
|
+
// }
|
|
2580
|
+
// }
|
|
2581
|
+
// }
|
|
2573
2582
|
for ( let [ index, data ] of getchecklist.entries() ) {
|
|
2574
2583
|
for ( let [ secIndex, section ] of data.questionAnswers.entries() ) {
|
|
2575
2584
|
questions = [];
|
|
2576
2585
|
for ( let question of section.questions ) {
|
|
2577
|
-
|
|
2586
|
+
if ( !question.linkType ) {
|
|
2587
|
+
questions.push( question );
|
|
2588
|
+
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 ) );
|
|
2590
|
+
questions.push( ...linkedQuestion );
|
|
2591
|
+
}
|
|
2578
2592
|
}
|
|
2579
2593
|
getchecklist[index].questionAnswers[secIndex].questions = questions;
|
|
2580
2594
|
}
|
|
@@ -248,9 +248,13 @@ export const create = async ( req, res ) => {
|
|
|
248
248
|
}
|
|
249
249
|
if ( answer.showLinked ) {
|
|
250
250
|
if ( nestedIndex != -1 ) {
|
|
251
|
-
section.questions[qIdx].answers[nestedIndex].nestedQuestion.
|
|
251
|
+
if ( !section.questions[qIdx].answers[nestedIndex].nestedQuestion.includes( answer.linkedQuestion ) ) {
|
|
252
|
+
section.questions[qIdx].answers[nestedIndex].nestedQuestion.push( answer.linkedQuestion );
|
|
253
|
+
}
|
|
252
254
|
} else {
|
|
253
|
-
section.questions[qIdx].answers[index].nestedQuestion.
|
|
255
|
+
if ( !section.questions[qIdx].answers[index].nestedQuestion.includes( answer.linkedQuestion ) ) {
|
|
256
|
+
section.questions[qIdx].answers[index].nestedQuestion.push( answer.linkedQuestion );
|
|
257
|
+
}
|
|
254
258
|
}
|
|
255
259
|
let nestedLinkedQuestion = section.questions.find( ( item ) => item.qno == answer.linkedQuestion );
|
|
256
260
|
if ( nestedLinkedQuestion ) {
|
|
@@ -753,9 +757,13 @@ export const update = async ( req, res ) => {
|
|
|
753
757
|
}
|
|
754
758
|
if ( answer.showLinked ) {
|
|
755
759
|
if ( nestedIndex != -1 ) {
|
|
756
|
-
section.questions[qIdx].answers[nestedIndex].nestedQuestion.
|
|
760
|
+
if ( !section.questions[qIdx].answers[nestedIndex].nestedQuestion.includes( answer.linkedQuestion ) ) {
|
|
761
|
+
section.questions[qIdx].answers[nestedIndex].nestedQuestion.push( answer.linkedQuestion );
|
|
762
|
+
}
|
|
757
763
|
} else {
|
|
758
|
-
section.questions[qIdx].answers[index].nestedQuestion.
|
|
764
|
+
if ( !section.questions[qIdx].answers[index].nestedQuestion.includes( answer.linkedQuestion ) ) {
|
|
765
|
+
section.questions[qIdx].answers[index].nestedQuestion.push( answer.linkedQuestion );
|
|
766
|
+
}
|
|
759
767
|
}
|
|
760
768
|
let nestedLinkedQuestion = section.questions.find( ( item ) => item.qno == answer.linkedQuestion );
|
|
761
769
|
if ( nestedLinkedQuestion ) {
|