tango-app-api-trax 3.3.1-beta-37 → 3.3.1-beta-39

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-37",
3
+ "version": "3.3.1-beta-39",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -26,7 +26,7 @@
26
26
  "mongodb": "^6.8.0",
27
27
  "nodemon": "^3.1.4",
28
28
  "path": "^0.12.7",
29
- "tango-api-schema": "^2.2.52",
29
+ "tango-api-schema": "^2.2.56",
30
30
  "tango-app-api-middleware": "^3.1.55",
31
31
  "url": "^0.11.4",
32
32
  "winston": "^3.13.1",
@@ -269,6 +269,37 @@ export async function startChecklist( req, res ) {
269
269
  getchecklist[index].questionAnswers[secIndex].questions = questions;
270
270
  }
271
271
  }
272
+
273
+ let orderedQuestions = [];
274
+
275
+ function processQuestion( question, section, questions, nested=false ) {
276
+ let findExists = orderedQuestions.find( ( item ) => item?.qno && item.qno == question.qno );
277
+ if ( findExists && nested && question.parentQuestion == findExists.parentQuestion ) {
278
+ let findIndex = orderedQuestions.findIndex( ( item ) => item?.qno && item.qno == question.qno );
279
+ orderedQuestions.splice( findIndex, 1 );
280
+ orderedQuestions.push( question );
281
+ }
282
+ if ( !findExists ) {
283
+ orderedQuestions.push( question );
284
+ for ( let answer of question.answers ) {
285
+ if ( answer.showLinked && answer?.linkedQuestion != '' ) {
286
+ let linkedQuestion = section.questions.find( ( item ) => item.qno == answer.linkedQuestion );
287
+ if ( linkedQuestion ) {
288
+ processQuestion( linkedQuestion, section, questions, true );
289
+ }
290
+ }
291
+ }
292
+ }
293
+ }
294
+ for ( let [ index, data ] of getchecklist.entries() ) {
295
+ for ( let [ secIndex, section ] of data.questionAnswers.entries() ) {
296
+ orderedQuestions = [];
297
+ for ( let question of section.questions ) {
298
+ processQuestion( question, section, questions );
299
+ }
300
+ getchecklist[index].questionAnswers[secIndex].questions = orderedQuestions;
301
+ }
302
+ }
272
303
  return res.sendSuccess( getchecklist );
273
304
  } else {
274
305
  return res.sendError( 'something went wrong please try again', 500 );
@@ -2454,6 +2485,7 @@ export async function checklistv1( req, res ) {
2454
2485
  ...projectExtraConditions,
2455
2486
  client_id: { $ifNull: [ '$client_id', '' ] },
2456
2487
  coverage: { $ifNull: [ '$coverage', '' ] },
2488
+ taskType: { $ifNull: [ '$type', '' ] },
2457
2489
  },
2458
2490
  },
2459
2491
  ];
@@ -2680,6 +2712,37 @@ export async function questionList( req, res ) {
2680
2712
  }
2681
2713
  }
2682
2714
 
2715
+ let orderedQuestions = [];
2716
+
2717
+ function processQuestion( question, section, questions, nested=false ) {
2718
+ let findExists = orderedQuestions.find( ( item ) => item?.qno && item.qno == question.qno );
2719
+ if ( findExists && nested && question.parentQuestion == findExists.parentQuestion ) {
2720
+ let findIndex = orderedQuestions.findIndex( ( item ) => item?.qno && item.qno == question.qno );
2721
+ orderedQuestions.splice( findIndex, 1 );
2722
+ orderedQuestions.push( question );
2723
+ }
2724
+ if ( !findExists ) {
2725
+ orderedQuestions.push( question );
2726
+ for ( let answer of question.answers ) {
2727
+ if ( answer.showLinked && answer?.linkedQuestion != '' ) {
2728
+ let linkedQuestion = section.questions.find( ( item ) => item.qno == answer.linkedQuestion );
2729
+ if ( linkedQuestion ) {
2730
+ processQuestion( linkedQuestion, section, questions, true );
2731
+ }
2732
+ }
2733
+ }
2734
+ }
2735
+ }
2736
+ for ( let [ index, data ] of getchecklist.entries() ) {
2737
+ for ( let [ secIndex, section ] of data.questionAnswers.entries() ) {
2738
+ orderedQuestions = [];
2739
+ for ( let question of section.questions ) {
2740
+ processQuestion( question, section, questions );
2741
+ }
2742
+ getchecklist[index].questionAnswers[secIndex].questions = orderedQuestions;
2743
+ }
2744
+ }
2745
+
2683
2746
  return res.sendSuccess( getchecklist );
2684
2747
  }
2685
2748
  } catch ( e ) {