tango-app-api-trax 3.6.1-runai-2 → 3.6.2-bulktask-2

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.1-runai-2",
3
+ "version": "3.6.2-bulktask-2",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -26,7 +26,7 @@
26
26
  "mongodb": "^6.8.0",
27
27
  "nodemon": "^3.1.4",
28
28
  "path": "^0.12.7",
29
- "tango-api-schema": "^2.2.197",
29
+ "tango-api-schema": "^2.2.198",
30
30
  "tango-app-api-middleware": "^3.1.77",
31
31
  "url": "^0.11.4",
32
32
  "winston": "^3.13.1",
@@ -12,7 +12,7 @@ import * as ApproverModel from '../services/approver.service.js';
12
12
  import mongoose from 'mongoose';
13
13
  import dayjs from 'dayjs';
14
14
  import { aggregateTeams, findteams } from '../services/teams.service.js';
15
- import { aggregate } from '../services/user.service.js';
15
+ import { aggregate, findOne } from '../services/user.service.js';
16
16
  // import axios from 'axios';
17
17
  import timeZone from 'dayjs/plugin/timezone.js';
18
18
  import customParseFormat from 'dayjs/plugin/customParseFormat.js';
@@ -1148,7 +1148,35 @@ export async function checkNotificationCount( req, res ) {
1148
1148
  return res.sendError( { error: error }, 500 );
1149
1149
  }
1150
1150
  }
1151
+ export async function taskvalidateUserData( req, res ) {
1152
+ try {
1153
+ let error = [];
1154
+ if ( req.body.coverage==='store' ) {
1155
+ for ( let [ index, store ] of req.body.assignedData.entries() ) {
1156
+ let findstore = await storeService.findOne( { clientId: req.body.clientId, storeName: store.storeName } );
1157
+ console.log( findstore );
1158
+ if ( !findstore ) {
1159
+ error.push( `Invalid StoreName - C${index + 2}` );
1160
+ }
1161
+ }
1162
+ }
1163
+ if ( req.body.coverage==='users' ) {
1164
+ for ( let [ index, user ] of req.body.assignedData.entries() ) {
1165
+ let finduser = await findOne( { clientId: req.body.clientId, email: user.userEmail } );
1166
+ if ( !finduser ) {
1167
+ error.push( `Invalid userEmail - C${index + 2}` );
1168
+ }
1169
+ }
1170
+ }
1171
+ if ( error.length ) {
1172
+ return res.sendError( error, 400 );
1173
+ }
1151
1174
 
1175
+ res.sendSuccess( 'success' );
1176
+ } catch ( error ) {
1177
+ logger.error( { error: error, function: 'taskvalidateUserData' } );
1178
+ }
1179
+ }
1152
1180
  export async function vehicleCheckInUpdate( req, res ) {
1153
1181
  try {
1154
1182
  let requestData = req.body;
@@ -281,7 +281,6 @@ export async function PCLconfigCreation( req, res ) {
281
281
  insertdata.checkListType = getCLconfig.checkListType;
282
282
  insertdata.storeCount = getCLconfig.storeCount;
283
283
  insertdata.questionCount = getCLconfig.questionCount;
284
- insertdata.runAIQuestionCount = getCLconfig.runAIQuestionCount;
285
284
  insertdata.publishDate = getCLconfig.publishDate;
286
285
  insertdata.locationCount = getCLconfig.locationCount;
287
286
  insertdata.scheduleRepeatedType = getCLconfig.scheduleRepeatedType;
@@ -560,7 +559,6 @@ export async function PCLconfigCreation( req, res ) {
560
559
  element4.checkListType = getCLconfig.checkListType;
561
560
  element4.storeCount = getCLconfig.storeCount;
562
561
  element4.questionCount = getCLconfig.questionCount;
563
- element4.runAIQuestionCount = getCLconfig.runAIQuestionCount;
564
562
  element4.publishDate = getCLconfig.publishDate;
565
563
  element4.locationCount = getCLconfig.locationCount;
566
564
  element4.scheduleRepeatedType = getCLconfig.scheduleRepeatedType;
@@ -377,8 +377,7 @@ export async function startTask( req, res ) {
377
377
 
378
378
 
379
379
  let updatedNewData;
380
- if ( task.checkListFrom && task.checkListFrom == 'api' ) {
381
- console.log( 'api if=>' );
380
+ if ( task.checkListFrom && [ 'api', 'gallery' ].includes( task.checkListFrom ) ) {
382
381
  updatedNewData = {
383
382
  checklistStatus: 'inprogress',
384
383
  startMobileTime: requestData?.currentTime,
@@ -617,9 +617,6 @@ export const flagCardsV1 = async ( req, res ) => {
617
617
  }
618
618
  } );
619
619
  flagCards.totalFlag += flagCards.detectionFlag.count;
620
- if ( resultData?.runAI ) {
621
- flagCards.runAIFlag = resultData?.runAI;
622
- }
623
620
  }
624
621
 
625
622
  return res.sendSuccess( { flagCards } );
@@ -822,8 +819,6 @@ export const flagTablesV1 = async ( req, res ) => {
822
819
  findAndQuery.push( { timeFlag: { $gte: 1 } } );
823
820
  } else if ( requestData?.filter === 'detection' ) {
824
821
  findAndQuery.push( { checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum' ] } } );
825
- } else if ( requestData?.filter === 'runAI' ) {
826
- findAndQuery.push( { runAIQuestionCount: { $gte: 1 } } );
827
822
  }
828
823
 
829
824
  findQuery.push( { $match: { $and: findAndQuery } } );
@@ -1038,7 +1033,7 @@ export const flagTablesV1 = async ( req, res ) => {
1038
1033
  if ( getChecklistPerformanceData.length ) {
1039
1034
  const detectionChecklists = getChecklistPerformanceData?.filter( ( val ) => val?.checkListType !== 'custom' );
1040
1035
 
1041
- if ( detectionChecklists?.length || requestData?.filter === 'runAI' ) {
1036
+ if ( detectionChecklists?.length ) {
1042
1037
  const detectionPayload = {
1043
1038
  'fromDate': requestData.fromDate,
1044
1039
  'toDate': requestData.toDate,
@@ -1051,23 +1046,13 @@ export const flagTablesV1 = async ( req, res ) => {
1051
1046
  if ( resultData ) {
1052
1047
  if ( resultData.status_code == '200' ) {
1053
1048
  for ( let index = 0; index < getChecklistPerformanceData.length; index++ ) {
1054
- if ( requestData?.filter === 'runAI' ) {
1055
- let findCheckList = resultData.runAI.list.find( ( ele ) => ele.checkListName == getChecklistPerformanceData[index].getChecklistPerformanceData );
1056
- if ( findCheckList ) {
1057
- getChecklistPerformanceData[index].flaggedStores = findCheckList.flagCount;
1058
- getChecklistPerformanceData[index].complianceRate = ( 100- ( getChecklistPerformanceData[index].flaggedStores / getChecklistPerformanceData[index].assignedStores ) * 100 );
1059
- getChecklistPerformanceData[index].complianceRate = Math.min( 100, Math.max( 0, getChecklistPerformanceData[index].complianceRate ) );
1060
- getChecklistPerformanceData[index].complianceRate = ( getChecklistPerformanceData[index].complianceRate % 1 === 0 ) ? getChecklistPerformanceData[index].complianceRate.toFixed( 0 ) : getChecklistPerformanceData[index].complianceRate.toFixed( 2 );
1061
- }
1062
- } else {
1063
- if ( getChecklistPerformanceData[index].checkListType !== 'custom' ) {
1064
- getChecklistPerformanceData[index].flagCount = resultData?.[getChecklistPerformanceData[index]?.checkListType] || 0;
1065
- getChecklistPerformanceData[index].flaggedStores = resultData?.[`${getChecklistPerformanceData[index]?.checkListType}_flaggedstores`] || 0;
1066
- getChecklistPerformanceData[index].assignedStores = getChecklistPerformanceData[index]?.aiStoreList?.filter( ( element ) => requestData.storeId.includes( element ) )?.length || 0;
1067
- getChecklistPerformanceData[index].complianceRate = ( 100- ( getChecklistPerformanceData[index].flaggedStores / getChecklistPerformanceData[index].assignedStores ) * 100 );
1068
- getChecklistPerformanceData[index].complianceRate = Math.min( 100, Math.max( 0, getChecklistPerformanceData[index].complianceRate ) );
1069
- getChecklistPerformanceData[index].complianceRate = ( getChecklistPerformanceData[index].complianceRate % 1 === 0 ) ? getChecklistPerformanceData[index].complianceRate.toFixed( 0 ) : getChecklistPerformanceData[index].complianceRate.toFixed( 2 );
1070
- }
1049
+ if ( getChecklistPerformanceData[index].checkListType !== 'custom' ) {
1050
+ getChecklistPerformanceData[index].flagCount = resultData?.[getChecklistPerformanceData[index]?.checkListType] || 0;
1051
+ getChecklistPerformanceData[index].flaggedStores = resultData?.[`${getChecklistPerformanceData[index]?.checkListType}_flaggedstores`] || 0;
1052
+ getChecklistPerformanceData[index].assignedStores = getChecklistPerformanceData[index]?.aiStoreList?.filter( ( element ) => requestData.storeId.includes( element ) )?.length || 0;
1053
+ getChecklistPerformanceData[index].complianceRate = ( 100- ( getChecklistPerformanceData[index].flaggedStores / getChecklistPerformanceData[index].assignedStores ) * 100 );
1054
+ getChecklistPerformanceData[index].complianceRate = Math.min( 100, Math.max( 0, getChecklistPerformanceData[index].complianceRate ) );
1055
+ getChecklistPerformanceData[index].complianceRate = ( getChecklistPerformanceData[index].complianceRate % 1 === 0 ) ? getChecklistPerformanceData[index].complianceRate.toFixed( 0 ) : getChecklistPerformanceData[index].complianceRate.toFixed( 2 );
1071
1056
  }
1072
1057
  }
1073
1058
  }
@@ -2403,7 +2388,7 @@ export const flagChecklistTableV1 = async ( req, res ) => {
2403
2388
  // let loginUser = { clientId: reqestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
2404
2389
  // let getUserEmails = await getChecklistUsers( loginUser );
2405
2390
  // End: Get User Based Checklist////
2406
- if ( reqestData.ChecklistType == 'custom' && reqestData?.filter !== 'runAI' ) {
2391
+ if ( reqestData.ChecklistType == 'custom' ) {
2407
2392
  const match = {
2408
2393
  $match: {
2409
2394
  $and: [
@@ -2515,7 +2500,7 @@ export const flagChecklistTableV1 = async ( req, res ) => {
2515
2500
  if ( reqestData.export ) {
2516
2501
  reqestData.limit = 10000;
2517
2502
  reqestData.offset = 0;
2518
- let LamdaURL = 'https://vpcejaftccr3jzqf5wrdkks7yy0krqix.lambda-url.ap-south-1.on.aws/';
2503
+ let LamdaURL = 'https://bnauly42yuztzrgtttodzt3bcm0oqrsi.lambda-url.ap-south-1.on.aws/';
2519
2504
  let resultData = await LamdaServiceCall( LamdaURL, reqestData );
2520
2505
  if ( resultData ) {
2521
2506
  if ( resultData.status_code == '200' ) {
@@ -2524,27 +2509,16 @@ export const flagChecklistTableV1 = async ( req, res ) => {
2524
2509
  if ( reqestData.ChecklistType==='scrum'||reqestData.ChecklistType==='cleaning' ) {
2525
2510
  reqestData.ChecklistType = 'scrumdetection';
2526
2511
  }
2527
- if ( reqestData?.filter === 'runAI' ) {
2528
- resultData.aiFlagData.forEach( ( element ) => {
2529
- exportdata.push( {
2530
- 'Date': dayjs( element.dateString ).format( 'DD MMM, YYYY' ),
2531
- 'Store Name': element?.storeName,
2532
- 'User Email': element?.spocEmail,
2533
- 'Detections': element?.detections,
2534
- } );
2535
- } );
2536
- } else {
2537
- resultData[reqestData.ChecklistType + 'Data'].forEach( ( element ) => {
2538
- exportdata.push( {
2539
- 'Date': element?.date,
2540
- 'Store Name': element?.storeName,
2541
- 'Store Id': element?.storeId,
2542
- // 'Store Spoc Email': element?.SpocEmail,
2543
- 'Detections': element?.detections,
2544
- 'Detection Status': element?.detectionStatus,
2545
- } );
2512
+ resultData[reqestData.ChecklistType + 'Data'].forEach( ( element ) => {
2513
+ exportdata.push( {
2514
+ 'Date': element?.date,
2515
+ 'Store Name': element?.storeName,
2516
+ 'Store Id': element?.storeId,
2517
+ // 'Store Spoc Email': element?.SpocEmail,
2518
+ 'Detections': element?.detections,
2519
+ 'Detection Status': element?.detectionStatus,
2546
2520
  } );
2547
- }
2521
+ } );
2548
2522
  return await download( exportdata, res );
2549
2523
  } else {
2550
2524
  return res.sendError( 'No Content', 204 );
@@ -2555,18 +2529,11 @@ export const flagChecklistTableV1 = async ( req, res ) => {
2555
2529
  }
2556
2530
  // console.log( reqestData );
2557
2531
 
2558
- let LamdaURL = 'https://vpcejaftccr3jzqf5wrdkks7yy0krqix.lambda-url.ap-south-1.on.aws/';
2532
+ let LamdaURL = 'https://bnauly42yuztzrgtttodzt3bcm0oqrsi.lambda-url.ap-south-1.on.aws/';
2559
2533
  let resultData = await LamdaServiceCall( LamdaURL, reqestData );
2560
2534
  // console.log( 'resultData =>', resultData );
2561
2535
  if ( resultData ) {
2562
2536
  if ( resultData.status_code == '200' ) {
2563
- if ( reqestData?.filter === 'runAI' ) {
2564
- resultData.aiFlagData = resultData.aiFlagData.map( ( ele ) => {
2565
- ele = { ...ele, date: dayjs( ele.dateString ).format( 'DD MMM, YYYY' ), storeSpocEmail: ele?.spocEmail, checklistStatus: 'submit' };
2566
- return ele;
2567
- } );
2568
- resultData = { customData: resultData.aiFlagData, totalCount: resultData.totalCount };
2569
- }
2570
2537
  return res.sendSuccess( resultData );
2571
2538
  } else {
2572
2539
  return res.sendError( 'No Content', 204 );
@@ -2904,25 +2871,21 @@ export const flagComparisonCardsV2 = async ( req, res ) => {
2904
2871
  },
2905
2872
  { checkListType: 1 },
2906
2873
  );
2907
- // if ( !publishedAiChecklists?.length ) {
2908
- // return 0;
2909
- // }
2874
+ if ( !publishedAiChecklists?.length ) {
2875
+ return 0;
2876
+ }
2910
2877
 
2911
2878
  const LamdaURL = 'https://f65azvtljclaxp6l7rnx65cdmm0lcgvp.lambda-url.ap-south-1.on.aws/';
2912
2879
  const resultData = await LamdaServiceCall( LamdaURL, detectionPayload );
2913
2880
  const published = publishedAiChecklists.map( ( val ) => val?.checkListType );
2914
2881
  if ( resultData?.status_code === '200' ) {
2915
2882
  let result = 0;
2916
- let ai = 0;
2917
- if ( !publishedAiChecklists?.length ) {
2918
- published.forEach( ( item ) => {
2919
- if ( resultData[item] ) {
2920
- result += resultData[item];
2921
- }
2922
- } );
2923
- }
2924
- ai = resultData?.runAI?.flagCount || 0;
2925
- return { result, ai };
2883
+ published.forEach( ( item ) => {
2884
+ if ( resultData[item] ) {
2885
+ result += resultData[item];
2886
+ }
2887
+ } );
2888
+ return result;
2926
2889
  }
2927
2890
  return 0;
2928
2891
  };
@@ -2947,17 +2910,15 @@ export const flagComparisonCardsV2 = async ( req, res ) => {
2947
2910
  questionComparisonFlag: { comparisonData: 0, ComparisonFlag: false },
2948
2911
  delayInSubmissionComparisonFlag: { comparisonData: 0, ComparisonFlag: false },
2949
2912
  detectionComparisonFlag: { comparisonData: 0, ComparisonFlag: false },
2950
- runAIComparisonFlag: { comparisonData: 0, ComparisonFlag: false },
2951
2913
  };
2952
2914
 
2953
2915
  if ( rangeOneData.length && rangeTwoData.length ) {
2954
- let rangeOneTotalFlag = rangeOneData[0].totalFlag + rangeOneDetectionCount.result || 0;
2955
- let rangeTwoTotalFlag = rangeTwoData[0].totalFlag + rangeTwoDetectionCount.result || 0;
2916
+ let rangeOneTotalFlag = rangeOneData[0].totalFlag + rangeOneDetectionCount || 0;
2917
+ let rangeTwoTotalFlag = rangeTwoData[0].totalFlag + rangeTwoDetectionCount || 0;
2956
2918
  flagComparisonCards.totalComparisonFlag = calculateComparison( rangeOneTotalFlag, rangeTwoTotalFlag );
2957
2919
  flagComparisonCards.questionComparisonFlag = calculateComparison( rangeOneData[0].questionFlag, rangeTwoData[0].questionFlag );
2958
2920
  flagComparisonCards.delayInSubmissionComparisonFlag = calculateComparison( rangeOneData[0].delayInSubmission, rangeTwoData[0].delayInSubmission );
2959
- flagComparisonCards.detectionComparisonFlag = calculateComparison( rangeOneDetectionCount.result, rangeTwoDetectionCount.result );
2960
- flagComparisonCards.runAIComparisonFlag = calculateComparison( rangeOneDetectionCount.ai, rangeTwoDetectionCount.ai );
2921
+ flagComparisonCards.detectionComparisonFlag = calculateComparison( rangeOneDetectionCount, rangeTwoDetectionCount );
2961
2922
  }
2962
2923
  flagComparisonCards.traxMonthlyComparison = false;
2963
2924
  let traxMonthlyComparisonData = await clientService.findOne( { clientId: requestData.clientId }, { traxMonthlyComparison: 1 } );
@@ -3000,8 +2961,6 @@ export const flagTablesV2 = async ( req, res ) => {
3000
2961
  findAndQuery.push( { timeFlag: { $gte: 1 } } );
3001
2962
  } else if ( requestData?.filter === 'detection' ) {
3002
2963
  findAndQuery.push( { checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum' ] } } );
3003
- } else if ( requestData?.filter === 'runAI' ) {
3004
- findAndQuery.push( { checkListName: { $in: req.body.runAIChecklistName } } );
3005
2964
  }
3006
2965
 
3007
2966
  findQuery.push( { $match: { $and: findAndQuery } } );
@@ -3030,7 +2989,6 @@ export const flagTablesV2 = async ( req, res ) => {
3030
2989
  scheduleRepeatedType: 1,
3031
2990
  store_id: 1,
3032
2991
  aiStoreList: 1,
3033
- runAIQuestionCount: 1,
3034
2992
  },
3035
2993
  } );
3036
2994
 
@@ -3077,7 +3035,6 @@ export const flagTablesV2 = async ( req, res ) => {
3077
3035
  aiStoreList: { $max: '$aiStoreList' },
3078
3036
  aiStoreListNew: { $sum: { $size: '$aiStoreList' } },
3079
3037
  submittedQuestionCount: { $sum: { $cond: [ { $eq: [ '$checklistStatus', 'submit' ] }, '$questionCount', 0 ] } },
3080
- runAIQuestionCount: { $last: '$runAIQuestionCount' },
3081
3038
  },
3082
3039
  } );
3083
3040
 
@@ -3099,7 +3056,6 @@ export const flagTablesV2 = async ( req, res ) => {
3099
3056
  customQuestionFlagCount: '$questionFlag',
3100
3057
  customTimeFlagCount: '$timeFlag',
3101
3058
  aiStoreList: 1,
3102
- runAIQuestionCount: 1,
3103
3059
  },
3104
3060
  } );
3105
3061
 
@@ -3133,7 +3089,6 @@ export const flagTablesV2 = async ( req, res ) => {
3133
3089
  customQuestionFlagCount: 1,
3134
3090
  customTimeFlagCount: 1,
3135
3091
  aiStoreList: 1,
3136
- runAIQuestionCount: 1,
3137
3092
  },
3138
3093
  } );
3139
3094
 
@@ -3160,7 +3115,7 @@ export const flagTablesV2 = async ( req, res ) => {
3160
3115
  if ( getChecklistPerformanceData.length ) {
3161
3116
  const detectionChecklists = getChecklistPerformanceData?.filter( ( val ) => val?.checkListType !== 'custom' );
3162
3117
 
3163
- if ( detectionChecklists?.length || [ 'runAI', 'all' ].includes( requestData?.filter ) ) {
3118
+ if ( detectionChecklists?.length ) {
3164
3119
  const detectionPayload = {
3165
3120
  'fromDate': requestData.fromDate,
3166
3121
  'toDate': requestData.toDate,
@@ -3173,37 +3128,13 @@ export const flagTablesV2 = async ( req, res ) => {
3173
3128
  if ( resultData ) {
3174
3129
  if ( resultData.status_code == '200' ) {
3175
3130
  for ( let index = 0; index < getChecklistPerformanceData.length; index++ ) {
3176
- if ( [ 'runAI', 'all' ].includes( requestData?.filter ) ) {
3177
- let findCheckList = resultData.runAI.list.find( ( ele ) => ele.checkListName == getChecklistPerformanceData[index].checkListName );
3178
- if ( findCheckList ) {
3179
- if ( requestData?.filter == 'all' ) {
3180
- getChecklistPerformanceData[index].runAIFlag = findCheckList.flagCount;
3181
- getChecklistPerformanceData[index].flaggedStores = getChecklistPerformanceData[index].flaggedStores + findCheckList.flagCount;
3182
- } else {
3183
- getChecklistPerformanceData[index].flagCount = findCheckList.flagCount;
3184
- getChecklistPerformanceData[index].flaggedStores = findCheckList.flagCount;
3185
- }
3186
- } else {
3187
- if ( requestData?.filter == 'all' ) {
3188
- getChecklistPerformanceData[index].runAIFlag = 0;
3189
- getChecklistPerformanceData[index].runAIFlagStore = 0;
3190
- } else {
3191
- getChecklistPerformanceData[index].flagCount = 0;
3192
- getChecklistPerformanceData[index].flaggedStores = 0;
3193
- }
3194
- }
3131
+ if ( getChecklistPerformanceData[index].checkListType !== 'custom' ) {
3132
+ getChecklistPerformanceData[index].flagCount = resultData?.[getChecklistPerformanceData[index]?.checkListType] || 0;
3133
+ getChecklistPerformanceData[index].flaggedStores = resultData?.[`${getChecklistPerformanceData[index]?.checkListType}_flaggedstores`] || 0;
3134
+ getChecklistPerformanceData[index].assignedStores = getChecklistPerformanceData[index]?.aiStoreList?.filter( ( element ) => requestData.storeId.includes( element ) )?.length || 0;
3195
3135
  getChecklistPerformanceData[index].complianceRate = ( 100- ( getChecklistPerformanceData[index].flaggedStores / getChecklistPerformanceData[index].assignedStores ) * 100 );
3196
3136
  getChecklistPerformanceData[index].complianceRate = Math.min( 100, Math.max( 0, getChecklistPerformanceData[index].complianceRate ) );
3197
3137
  getChecklistPerformanceData[index].complianceRate = ( getChecklistPerformanceData[index].complianceRate % 1 === 0 ) ? getChecklistPerformanceData[index].complianceRate.toFixed( 0 ) : getChecklistPerformanceData[index].complianceRate.toFixed( 2 );
3198
- } else {
3199
- if ( getChecklistPerformanceData[index].checkListType !== 'custom' ) {
3200
- getChecklistPerformanceData[index].flagCount = resultData?.[getChecklistPerformanceData[index]?.checkListType] || 0;
3201
- getChecklistPerformanceData[index].flaggedStores = resultData?.[`${getChecklistPerformanceData[index]?.checkListType}_flaggedstores`] || 0;
3202
- getChecklistPerformanceData[index].assignedStores = getChecklistPerformanceData[index]?.aiStoreList?.filter( ( element ) => requestData.storeId.includes( element ) )?.length || 0;
3203
- getChecklistPerformanceData[index].complianceRate = ( 100- ( getChecklistPerformanceData[index].flaggedStores / getChecklistPerformanceData[index].assignedStores ) * 100 );
3204
- getChecklistPerformanceData[index].complianceRate = Math.min( 100, Math.max( 0, getChecklistPerformanceData[index].complianceRate ) );
3205
- getChecklistPerformanceData[index].complianceRate = ( getChecklistPerformanceData[index].complianceRate % 1 === 0 ) ? getChecklistPerformanceData[index].complianceRate.toFixed( 0 ) : getChecklistPerformanceData[index].complianceRate.toFixed( 2 );
3206
- }
3207
3138
  }
3208
3139
  }
3209
3140
  }
@@ -3216,13 +3147,12 @@ export const flagTablesV2 = async ( req, res ) => {
3216
3147
  getChecklistPerformanceData.forEach( ( element ) => {
3217
3148
  const data = {
3218
3149
  'Checklist Name': element.checkListName,
3219
- 'Coverage': element?.coverage,
3220
- 'Assigned Stores': element?.checkListType === 'custom' ? element?.assignedStores : element?.assignedStoresAi,
3221
- 'Flagged Stores': element?.flaggedStores,
3222
3150
  'Question Flags': element?.customQuestionFlagCount,
3223
- ...( element.runAIFlag ? { 'Run AI Flag': element.runAIFlag } : {} ),
3224
3151
  'Not Submitted Flags': element?.customTimeFlagCount,
3225
3152
  'Detection Flags': element?.flagCount,
3153
+ 'Coverage': element?.coverage,
3154
+ 'Assigned Stores': element?.checkListType === 'custom' ? element?.assignedStores : element?.assignedStoresAi,
3155
+ 'Flagged Stores': element?.flaggedStores,
3226
3156
  'Compliance': element?.complianceRate,
3227
3157
  // 'Flag Type': element?.checkListType === 'custom' ? 'Question' : 'Detection',
3228
3158
  };
@@ -3232,21 +3162,18 @@ export const flagTablesV2 = async ( req, res ) => {
3232
3162
  delete data['Flagged Count'];
3233
3163
  delete data['Not Submitted Flags'];
3234
3164
  delete data['Detection Flags'];
3235
- delete data['Run AI Flag'];
3236
3165
  } else if ( requestData?.filter === 'time' ) {
3237
3166
  data['Flags'] = data['Not Submitted Flags'];
3238
3167
  delete data['Question Flags'];
3239
3168
  delete data['Flagged Count'];
3240
3169
  delete data['Not Submitted Flags'];
3241
3170
  delete data['Detection Flags'];
3242
- delete data['Run AI Flag'];
3243
3171
  } else if ( requestData?.filter === 'detection' ) {
3244
3172
  data['Flags'] = data['Detection Flags'];
3245
3173
  delete data['Question Flags'];
3246
3174
  delete data['Flagged Count'];
3247
3175
  delete data['Not Submitted Flags'];
3248
3176
  delete data['Detection Flags'];
3249
- delete data['Run AI Flag'];
3250
3177
  }
3251
3178
  exportdata.push( data );
3252
3179
  } );
@@ -174,8 +174,6 @@ export const create = async ( req, res ) => {
174
174
  checkNumber = 1;
175
175
  }
176
176
 
177
- let runAIQuestionCount = 0;
178
-
179
177
  inputBody.sections.forEach( async ( element ) => {
180
178
  if ( !element?.questions?.length && inputBody.submitType == 'configure' ) {
181
179
  return res.sendError( { message: 'Question is Required' }, 400 );
@@ -183,8 +181,6 @@ export const create = async ( req, res ) => {
183
181
  if ( element?.questions?.length ) {
184
182
  questionCount = questionCount + element?.questions?.length;
185
183
  }
186
- let runAiQuestions = element?.questions.filter( ( qn ) => qn.runAI );
187
- runAIQuestionCount +=runAiQuestions.length;
188
184
  } );
189
185
 
190
186
  let checkListDetails = {
@@ -197,7 +193,6 @@ export const create = async ( req, res ) => {
197
193
  questionCount: questionCount,
198
194
  client_id: req.body?.clientId,
199
195
  owner: req.user.userType == 'client' ? [ { name: req.user.userName, value: req.user.email } ] : [],
200
- runAIQuestionCount: runAIQuestionCount,
201
196
  // configStartDate:new Date(),
202
197
  // configEndDate:new Date(),
203
198
  };
@@ -817,7 +812,7 @@ export const update = async ( req, res ) => {
817
812
  }
818
813
 
819
814
  let getExistQuestions = await questionService.findSort( { checkListId: req.params.checklistId, client_id: req.body.clientId }, {}, { sectionNumber: 1 } );
820
- let runAIQuestionCount = 0;
815
+
821
816
  inputBody.sections.forEach( async ( element ) => {
822
817
  if ( !element.questions.length && inputBody.submitType == 'configure' ) {
823
818
  return res.sendError( { message: 'Question is Required' }, 400 );
@@ -826,8 +821,6 @@ export const update = async ( req, res ) => {
826
821
  if ( element.questions.length ) {
827
822
  questionCount = questionCount + element.questions.length;
828
823
  }
829
- let runAiQuestions = element?.questions.filter( ( qn ) => qn.runAI );
830
- runAIQuestionCount +=runAiQuestions.length;
831
824
  } );
832
825
 
833
826
 
@@ -835,7 +828,6 @@ export const update = async ( req, res ) => {
835
828
  checkListName: inputBody.checklistName,
836
829
  checkListDescription: inputBody.checklistDescription,
837
830
  questionCount: questionCount,
838
- runAIQuestionCount: runAIQuestionCount,
839
831
  };
840
832
 
841
833
  await checklistService.updateOne( { _id: req.params.checklistId }, params );
@@ -2959,7 +2951,6 @@ export async function insertSingleProcessData( checklistId, processId = 0, oldDa
2959
2951
  insertdata.checkListType = getCLconfig.checkListType;
2960
2952
  insertdata.storeCount = getCLconfig.storeCount;
2961
2953
  insertdata.questionCount = getCLconfig.questionCount;
2962
- insertdata.runAIQuestionCount = getCLconfig.runAIQuestionCount;
2963
2954
  insertdata.publishDate = getCLconfig.publishDate;
2964
2955
  insertdata.locationCount = getCLconfig.locationCount;
2965
2956
  insertdata.scheduleRepeatedType = getCLconfig.scheduleRepeatedType;
@@ -3680,7 +3671,6 @@ async function insertPCBulkV4( getCLconfig, checklistId, currentdate, updatedche
3680
3671
  element4.checkListType = getCLconfig.checkListType;
3681
3672
  element4.storeCount = getCLconfig.storeCount;
3682
3673
  element4.questionCount = getCLconfig.questionCount;
3683
- element4.runAIQuestionCount = getCLconfig.runAIQuestionCount;
3684
3674
  element4.publishDate = getCLconfig.publishDate;
3685
3675
  element4.locationCount = getCLconfig.locationCount;
3686
3676
  element4.scheduleRepeatedType = getCLconfig.scheduleRepeatedType;
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { getchecklist, viewchecklist, getMobileUseagelist, storeOpencloselist, getcustomerunattendedlist,
4
4
  storesList, checklistDropdown, redoChecklist, redomultiChecklist, approveChecklist,
5
- approvalstatus, getLogs, headerStoresV2, teamsList, userList, checkNotificationCount, vehicleCheckInUpdate } from '../controllers/gallery.controller.js';
5
+ approvalstatus, getLogs, headerStoresV2, teamsList, userList, checkNotificationCount, vehicleCheckInUpdate, taskvalidateUserData } from '../controllers/gallery.controller.js';
6
6
  import express from 'express';
7
7
  export const galleryRouter = express.Router();
8
8
  import { validate, isAllowedSessionHandler, isAllowedClient, getAssinedStore } from 'tango-app-api-middleware';
@@ -32,5 +32,6 @@ galleryRouter
32
32
  .post( '/headerStores_v2', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.validateHeaderParamsv2 ), getAssinedStore, headerStoresV2 )
33
33
  .get( '/teamsList', isAllowedSessionHandler, isAllowedClient, teamsList )
34
34
  .post( '/userList', isAllowedSessionHandler, isAllowedClient, userList )
35
+ .post( '/taskvalidateUserData', isAllowedSessionHandler, isAllowedClient, taskvalidateUserData )
35
36
  .post( '/checkNotificationCount', isAllowedSessionHandler, getAssinedStore, checkNotificationCount )
36
37
  .post( '/vehicleCheckInUpdate', isAllowedSessionHandler, vehicleCheckInUpdate );