tango-app-api-trax 3.7.64 → 3.7.66

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.7.64",
3
+ "version": "3.7.66",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -2017,7 +2017,7 @@ export async function submitChecklist( req, res ) {
2017
2017
  let checklistDetails = await checklistService.findOne( { _id: getchecklist[0].sourceCheckList_id }, { notifyFlags: 1, approver: 1 } );
2018
2018
  if ( checklistDetails?.notifyFlags?.notifyType?.length ) {
2019
2019
  let emailList = checklistDetails?.notifyFlags?.notifyType.includes( 'approver' ) ? checklistDetails.approver.flatMap( ( ele ) => ele?.value ): [];
2020
- emailList = [ ...emailList, ...checklistDetails?.notifyFlags?.notifyType?.users.flatMap( ( ele ) => ele?.value ) ];
2020
+ emailList = [ ...emailList, ...checklistDetails?.notifyFlags?.users?.map( ( ele ) => ele?.value ) ];
2021
2021
  let data = {
2022
2022
  storeName: getchecklist[0].storeName,
2023
2023
  flagCount: updateData.questionFlag,
@@ -2026,7 +2026,7 @@ export async function submitChecklist( req, res ) {
2026
2026
  time: updateData.submitMobileTime,
2027
2027
  domain: JSON.parse( process.env.URL ).domain,
2028
2028
  };
2029
- const fileContent = readFileSync( join() + '/src/hbs/flag.hbs', 'utf8' );
2029
+ const fileContent = fs.readFileSync( path.resolve( path.dirname( '' ) ) + '/src/hbs/flag.hbs', 'utf8' );
2030
2030
  const htmlContent = handlebars.compile( fileContent );
2031
2031
  const html = htmlContent( { data: data } );
2032
2032
  emailList.forEach( ( email ) => {
@@ -4540,7 +4540,7 @@ export async function downloadChecklist( req, res ) {
4540
4540
  let requestData = req.body;
4541
4541
 
4542
4542
  if ( !requestData.checklistId ) {
4543
- res.sendBadRequest( 'checklistId is Required' );
4543
+ res.sendError( 'checklistId is Required' );
4544
4544
  }
4545
4545
 
4546
4546
  let checklistDetails;
@@ -4656,6 +4656,6 @@ export async function downloadChecklist( req, res ) {
4656
4656
  return res.end( pdfBuffer );
4657
4657
  } catch ( e ) {
4658
4658
  logger.error( { functionName: 'getChecklistQuestionAnswers', error: e } );
4659
- return e;
4659
+ return res.sendError( e );
4660
4660
  }
4661
4661
  }
@@ -295,7 +295,7 @@ export const checklistPerformance = async ( req, res ) => {
295
295
  const complianceData = await LamdaServiceCall( complianceURL, detectionPayload );
296
296
  if ( complianceData ) {
297
297
  const end = skip + requestData?.limit;
298
- checklistIdList = complianceData.slice( start, end )?.map( ( ele ) => ele?.checklistId );
298
+ checklistIdList = complianceData.slice( skip, end )?.map( ( ele ) => ele?.checklistId );
299
299
  }
300
300
 
301
301
 
@@ -312,7 +312,6 @@ export const checklistPerformance = async ( req, res ) => {
312
312
  { client_id: requestData.clientId },
313
313
  // { store_id: { $in: requestData.storeId } },
314
314
  { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ] },
315
-
316
315
  );
317
316
 
318
317
  if ( requestData?.sortColumnName == 'questionCompliance' ) {
@@ -452,7 +451,10 @@ export const checklistPerformance = async ( req, res ) => {
452
451
  }
453
452
 
454
453
  getChecklistPerformanceData.forEach( ( ele ) => {
455
- let findCompliance = complianceData?.find( ( data ) => data.checklistId == ele?.sourceCheckList_id );
454
+ let findCompliance;
455
+ if ( complianceData ) {
456
+ findCompliance = complianceData?.find( ( data ) => data.checklistId == ele?.sourceCheckList_id );
457
+ }
456
458
  ele['questionComplianceRate'] = findCompliance?.compliance ?? 0;
457
459
  } );
458
460