tango-app-api-trax 3.9.43 → 3.9.44

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.9.43",
3
+ "version": "3.9.44",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -30,7 +30,7 @@
30
30
  "path": "^0.12.7",
31
31
  "puppeteer": "^24.39.1",
32
32
  "swagger-ui-express": "^5.0.1",
33
- "tango-api-schema": "^2.6.23",
33
+ "tango-api-schema": "^2.6.17",
34
34
  "tango-app-api-middleware": "^3.5.2",
35
35
  "url": "^0.11.4",
36
36
  "winston": "^3.13.1",
@@ -931,7 +931,7 @@ async function insertData( requestData ) {
931
931
  },
932
932
  } );
933
933
  let getSections = await CLquestions.aggregate( sectionQuery );
934
- if ( getSections.length || [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'cleaning', 'scrum', 'suspiciousactivity', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert', 'staffgrouping', 'boxalert', 'employeeCount', 'unattendeddetection', 'employeemonitoring', 'activitymonitoring' ].includes( getCLconfig.checkListType ) ) {
934
+ if ( getSections.length || [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'cleaning', 'scrum', 'suspiciousactivity', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert', 'staffgrouping', 'boxalert', 'employeeCount', 'unattendeddetection', 'employeemonitoring' ].includes( getCLconfig.checkListType ) ) {
935
935
  if ( getSections.length ) {
936
936
  for ( let element3 of getSections ) {
937
937
  let collectQuestions = {};
@@ -1226,11 +1226,11 @@ async function insertData( requestData ) {
1226
1226
  // }
1227
1227
  }
1228
1228
  } else {
1229
- if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'cleaning', 'scrum', 'suspiciousactivity', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert', 'staffgrouping', 'boxalert', 'employeeCount', 'unattendeddetection', 'employeemonitoring', 'activitymonitoring' ].includes( getCLconfig.checkListType ) ) {
1229
+ if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'cleaning', 'scrum', 'suspiciousactivity', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert', 'staffgrouping', 'boxalert', 'employeeCount', 'unattendeddetection', 'employeemonitoring' ].includes( getCLconfig.checkListType ) ) {
1230
1230
  let storeNameList = allQuestion.map( ( item ) => item.store_id );
1231
- let storeDetails = await storeService.find( { clientId: getCLconfig.client_id, status: 'active', ...( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert', 'staffgrouping', 'boxalert', 'employeeCount', 'unattendeddetection', 'employeemonitoring', 'activitymonitoring' ].includes( getCLconfig.checkListType ) ) ? { storeId: { $in: storeNameList } } : {} }, { storeId: 1 } );
1231
+ let storeDetails = await storeService.find( { clientId: getCLconfig.client_id, status: 'active', ...( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert', 'staffgrouping', 'boxalert', 'employeeCount', 'unattendeddetection', 'employeemonitoring' ].includes( getCLconfig.checkListType ) ) ? { storeId: { $in: storeNameList } } : {} }, { storeId: 1 } );
1232
1232
  let storeList = storeDetails.map( ( store ) => store.storeId );
1233
- if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert', 'staffgrouping', 'boxalert', 'employeeCount', 'unattendeddetection', 'employeemonitoring', 'activitymonitoring' ].includes( getCLconfig.checkListType ) ) {
1233
+ if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert', 'staffgrouping', 'boxalert', 'employeeCount', 'unattendeddetection', 'employeemonitoring' ].includes( getCLconfig.checkListType ) ) {
1234
1234
  allQuestion = allQuestion.filter( ( ele ) => storeList.includes( ele?.store_id ) );
1235
1235
  } else {
1236
1236
  allQuestion = storeDetails.map( ( item ) => {
@@ -3684,12 +3684,12 @@ export async function runAIFlag( req, res ) {
3684
3684
  let date = dayjs().format( 'YYYY-MM-DD' );
3685
3685
  if ( checklistDetails.length ) {
3686
3686
  await Promise.all( checklistDetails.map( async ( ele ) => {
3687
- let submitDetails = await processedchecklist.find( { sourceCheckList_id: ele._id, date_string: date, $or: [ { timeFlag: { $gt: 0 } }, { questionFlag: { $gt: 0 } }, { runAIFlag: { $gt: 0 } } ] }, { storeName: 1, checkListName: 1, userName: 1, submitTime_string: 1, runAIFlag: 1, questionFlag: 1, checklistStatus: 1 } );
3687
+ let submitDetails = await processedchecklist.find( { sourceCheckList_id: ele._id, date_string: date, $or: [ { timeFlag: { $gt: 0 } }, { questionFlag: { $gt: 0 } }, { runAIFlag: { $gt: 0 } } ] }, { storeName: 1, checkListName: 1, userName: 1, submitTime_string: 1, runAIFlag: 1, questionFlag: 1, checklistStatus: 1, coverage: 1, scheduleEndTime: 1 } );
3688
3688
  let emailList = ele?.notifyFlags?.notifyType.includes( 'approver' ) ? ele.approver.map( ( approver ) => approver?.value ): [];
3689
3689
  emailList = [ ...emailList, ...ele?.notifyFlags?.users?.map( ( user ) => user?.value ) ];
3690
3690
  await Promise.all( submitDetails.map( ( store ) => {
3691
3691
  let data = {
3692
- storeName: store.storeName,
3692
+ storeName: store.coverage == 'store' ? store?.storeName : store.userName,
3693
3693
  flagCount: store.timeFlag ? 1 : store?.runAIFlag + store?.questionFlag,
3694
3694
  runAIFlag: store?.runAIFlag,
3695
3695
  questionFlag: store?.questionFlag,
@@ -3698,6 +3698,8 @@ export async function runAIFlag( req, res ) {
3698
3698
  time: store.timeFlag ? '--' : store?.submitTime_string,
3699
3699
  domain: `${JSON.parse( process.env.URL ).domain}/manage/trax/flags?date=${dayjs().format( 'YYYY-MM-DD' )}`,
3700
3700
  status: store.checklistStatus,
3701
+ coverage: store.coverage,
3702
+ scheduleEndTime: `${store.scheduleEndTime}, ${dayjs().format( 'DD MMM YYYY' )}`,
3701
3703
  };
3702
3704
  const fileContent = fs.readFileSync( path.resolve( path.dirname( '' ) ) + '/src/hbs/flag.hbs', 'utf8' );
3703
3705
  const htmlContent = handlebars.compile( fileContent );