tango-app-api-trax 3.4.1-alpha-13 → 3.4.1-alpha-16

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.4.1-alpha-13",
3
+ "version": "3.4.1-alpha-16",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -2785,7 +2785,7 @@ export async function questionList( req, res ) {
2785
2785
  let getQn = questionList.get( qn );
2786
2786
  if ( getQn ) {
2787
2787
  let randomNo;
2788
- if ( !getQn?.uniqueNo ) {
2788
+ if ( !getQn?.uniqueNo || uniqueShow ) {
2789
2789
  randomNo = parseInt( getOtp() ) + Date.now() + qidx;
2790
2790
  } else {
2791
2791
  randomNo = getQn?.uniqueNo;
@@ -2492,6 +2492,10 @@ export const flagChecklistTableV1 = async ( req, res ) => {
2492
2492
  if ( resultData ) {
2493
2493
  if ( resultData.status_code == '200' ) {
2494
2494
  const exportdata = [];
2495
+ console.log( resultData );
2496
+ if ( reqestData.ChecklistType==='scrum'||reqestData.ChecklistType==='cleaning' ) {
2497
+ reqestData.ChecklistType = 'scrumdetection';
2498
+ }
2495
2499
  resultData[reqestData.ChecklistType + 'Data'].forEach( ( element ) => {
2496
2500
  exportdata.push( {
2497
2501
  'Date': element?.date,
@@ -3196,15 +3196,16 @@ async function insertPCBulkV4( getCLconfig, checklistId, currentdate, updatedche
3196
3196
  delete ans.index;
3197
3197
  delete ans.validationAnswer;
3198
3198
  delete ans.answeroptionNumber;
3199
- ans.nestedQuestion = ans?.oldNestedQuestion ? ans.oldNestedQuestion : [];
3200
- ans.linkedQuestion = ans?.oldLinkedQuestion ? ans.oldLinkedQuestion : 0;
3199
+ ans.nestedQuestion = ans?.oldNestedQuestion ? ans.oldNestedQuestion : ans.nestedQuestion;
3200
+ ans.linkedQuestion = ans?.oldLinkedQuestion ? ans.oldLinkedQuestion : ans.linkedQuestion;
3201
3201
  delete ans.oldNestedQuestion;
3202
3202
  delete ans.oldLinkedQuestion;
3203
3203
  } );
3204
3204
  const compare = findDifferences( data, qns );
3205
3205
  if ( compare?.answerType || compare?.answers || compare?.linkType ) {
3206
3206
  logger.info( 'compare =>', compare );
3207
- logger.info( 'qno =>', data.qno );
3207
+ logger.info( 'compareSection =>', { section: section.sectionName } );
3208
+ logger.info( 'qno =>', { qno: data.qno } );
3208
3209
  modifiedCount++;
3209
3210
  question.push( { question: qns, type: 'qnEdit' } );
3210
3211
  } else {
@@ -3225,27 +3226,34 @@ async function insertPCBulkV4( getCLconfig, checklistId, currentdate, updatedche
3225
3226
  sectionList.push( { sectionName: section?.sectionName, oldName: section?.sectionOldName, question: section.questions, type: 'add' } );
3226
3227
  }
3227
3228
  }
3228
- console.log( JSON.stringify( sectionList ) );
3229
3229
  // getsubmitDetails[0].questionAnswers = sectionList;
3230
3230
  sectionList.forEach( ( sec ) => {
3231
3231
  if ( sec.type == 'add' ) {
3232
3232
  getsubmitDetails[0].questionAnswers.push( sec );
3233
3233
  } else {
3234
3234
  sec.question.forEach( ( qn ) => {
3235
- console.log( qn, 'qn' );
3236
3235
  let sectionDetails = getsubmitDetails[0].questionAnswers.findIndex( ( section ) => section.sectionName == sec?.oldName || section.sectionName == sec.sectionName );
3237
- console.log( sectionDetails, 'detauls' );
3238
3236
  if ( qn.type == 'add' ) {
3239
3237
  getsubmitDetails[0].questionAnswers[sectionDetails].questions.push( qn.question );
3240
3238
  } else {
3241
- const questions = getsubmitDetails[0].questionAnswers[sectionDetails].questions.reduce( ( acc, ele, idx ) => {
3239
+ let questions = getsubmitDetails[0].questionAnswers[sectionDetails].questions.reduce( ( acc, ele, idx ) => {
3242
3240
  if ( ele.qname.trim() == qn?.question?.oldQname?.trim() || ele.qname.trim() == qn.question.qname.trim() ) {
3243
3241
  acc.push( idx );
3244
3242
  }
3245
3243
  return acc;
3246
3244
  }, [] );
3247
- console.log( questions, 'question' );
3248
3245
  if ( questions.length && [ 'qnEdit', 'nameChange' ].includes( qn.type ) ) {
3246
+ if ( qn.type == 'qnEdit' ) {
3247
+ let checkLinkType = getsubmitDetails[0].questionAnswers[sectionDetails].questions[questions[0]].linkType;
3248
+ if ( checkLinkType && !qn.question.linkType ) {
3249
+ questions.forEach( ( qnIdx, index ) => {
3250
+ if ( index != 0 ) {
3251
+ getsubmitDetails[0].questionAnswers[sectionDetails].questions.splice( qnIdx, 1 );
3252
+ }
3253
+ } );
3254
+ questions = [ questions[0] ];
3255
+ }
3256
+ }
3249
3257
  questions.forEach( ( qnIdx ) => {
3250
3258
  if ( qn.type == 'qnEdit' ) {
3251
3259
  getsubmitDetails[0].questionAnswers[sectionDetails].questions[qnIdx] = qn.question;