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

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-14",
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;
@@ -3238,7 +3238,7 @@ async function insertPCBulkV4( getCLconfig, checklistId, currentdate, updatedche
3238
3238
  if ( qn.type == 'add' ) {
3239
3239
  getsubmitDetails[0].questionAnswers[sectionDetails].questions.push( qn.question );
3240
3240
  } else {
3241
- const questions = getsubmitDetails[0].questionAnswers[sectionDetails].questions.reduce( ( acc, ele, idx ) => {
3241
+ let questions = getsubmitDetails[0].questionAnswers[sectionDetails].questions.reduce( ( acc, ele, idx ) => {
3242
3242
  if ( ele.qname.trim() == qn?.question?.oldQname?.trim() || ele.qname.trim() == qn.question.qname.trim() ) {
3243
3243
  acc.push( idx );
3244
3244
  }
@@ -3246,6 +3246,17 @@ async function insertPCBulkV4( getCLconfig, checklistId, currentdate, updatedche
3246
3246
  }, [] );
3247
3247
  console.log( questions, 'question' );
3248
3248
  if ( questions.length && [ 'qnEdit', 'nameChange' ].includes( qn.type ) ) {
3249
+ if ( qn.type == 'qnEdit' ) {
3250
+ let checkLinkType = getsubmitDetails[0].questionAnswers[sectionDetails].questions[questions[0]].linkType;
3251
+ if ( checkLinkType && !qn.question.linkType ) {
3252
+ questions.forEach( ( qnIdx, index ) => {
3253
+ if ( index != 0 ) {
3254
+ getsubmitDetails[0].questionAnswers[sectionDetails].questions[questions[0]].splice( qnIdx, 1 );
3255
+ }
3256
+ } );
3257
+ questions = [ questions[0] ];
3258
+ }
3259
+ }
3249
3260
  questions.forEach( ( qnIdx ) => {
3250
3261
  if ( qn.type == 'qnEdit' ) {
3251
3262
  getsubmitDetails[0].questionAnswers[sectionDetails].questions[qnIdx] = qn.question;
@@ -3266,6 +3277,7 @@ async function insertPCBulkV4( getCLconfig, checklistId, currentdate, updatedche
3266
3277
  getsubmitDetails[0].approvalStatus = false;
3267
3278
  }
3268
3279
  let data = { ...getsubmitDetails[0]._doc };
3280
+ console.log( JSON.stringify( data ), 'data' );
3269
3281
  await processedchecklist.updateOne( { _id: getsubmitDetails[0]._id }, data );
3270
3282
  if ( editSubmit && getsubmitDetails[0].checklistStatus == 'submit' ) {
3271
3283
  let user = {