tango-app-api-trax 3.6.2-bulktask-3 → 3.6.2-bulktask-4

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.6.2-bulktask-3",
3
+ "version": "3.6.2-bulktask-4",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -547,7 +547,7 @@ export async function redomultiChecklist( req, res ) {
547
547
  try {
548
548
  let inputData = req.body.payload.coverage === 'user' ? req.body.payload.userEmail : req.body.payload.storeName;
549
549
 
550
-
550
+ let inputBody = req.body;
551
551
  for ( let originalData of inputData ) {
552
552
  if ( !originalData.checklistId ) {
553
553
  return res.sendError( 'Id is Required', 400 );
@@ -559,6 +559,15 @@ export async function redomultiChecklist( req, res ) {
559
559
  return res.sendError( 'Question number is Required', 400 );
560
560
  }
561
561
 
562
+ let findcomment= {};
563
+ if ( !inputBody.payload.showcomment ) {
564
+ if ( inputBody.payload?.coverage ==='store' ) {
565
+ findcomment = inputBody.payload.excelData.find( ( ele ) => ele.storeName === originalData.storeName );
566
+ } else if ( inputBody.payload?.coverage==='users' ) {
567
+ findcomment = inputBody.payload.excelData.find( ( ele ) => ele.userEmail === originalData.userEmail );
568
+ }
569
+ }
570
+ console.log( '****************', findcomment );
562
571
 
563
572
  let checklistDetails = await processedChecklist.findOne( { _id: originalData.checklistId }, { questionAnswers: 1, redoStatus: 1, checklistStatus: 1, client_id: 1, store_id: 1, storeName: 1, checkListType: 1, sourceCheckList_id: 1, checkListName: 1, submitTime: 1, userName: 1, answerType: 1 } );
564
573
  if ( !checklistDetails ) {
@@ -574,7 +583,7 @@ export async function redomultiChecklist( req, res ) {
574
583
 
575
584
  let findQuestion = question[sectionIndex].questions.findIndex( ( ele ) => ele.qno == req.body.payload.qno );
576
585
 
577
- let data = { ...question[sectionIndex].questions[findQuestion], redo: true, redoComment: req.body.payload?.checklistDescription || '' };
586
+ let data = { ...question[sectionIndex].questions[findQuestion], redo: true, redoComment: req.body.payload?.showcomment? req.body.payload?.checklistDescription:findcomment?.comments };
578
587
  // if ( checklistDetails.client_id == '458' ) {
579
588
  data.answers.forEach( ( item ) => {
580
589
  if ( item.showLinked ) {
@@ -621,7 +630,7 @@ export async function redomultiChecklist( req, res ) {
621
630
  data = {
622
631
  checklistId: checklistDetails.sourceCheckList_id,
623
632
  checkListName: checklistDetails.checkListName,
624
- checklistDescription: req.body.payload.checklistDescription,
633
+ checklistDescription: req.body.payload?.showcomment? req.body.payload?.checklistDescription:findcomment?.comments,
625
634
  sectionId: originalData.section_id,
626
635
  sectionName: question[sectionIndex].sectionName,
627
636
  questionName: question[sectionIndex].questions[findQuestion].qname,