tango-app-api-trax 3.2.1-hotfix-5 → 3.2.1-hotfix-7

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.2.1-hotfix-5",
3
+ "version": "3.2.1-hotfix-7",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -470,7 +470,8 @@ async function insertData( requestData ) {
470
470
  client_id: getCLconfig.client_id,
471
471
  aiStoreList: storeDetails ? storeDetails.map( ( store ) => store.storeId ) : [],
472
472
  };
473
- await processedchecklist.create( data );
473
+ // await processedchecklist.create( data );
474
+ await processedchecklist.updateOne( { date_string: currentdate, checkListId: updatedchecklist._id, sourceCheckList_id: getCLconfig._id, checkListType: getCLconfig.checkListType }, data );
474
475
  }
475
476
  }
476
477
  }
@@ -831,7 +831,8 @@ export const flagTablesV1 = async ( req, res ) => {
831
831
  );
832
832
 
833
833
  if ( requestData?.filter === 'all' ) {
834
- findAndQuery.push( { $or: [ { questionFlag: { $gte: 1 } }, { timeFlag: { $gte: 1 } }, { checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection' ] } } ] } );
834
+ // findAndQuery.push( { $or: [ { questionFlag: { $gte: 1 } }, { timeFlag: { $gte: 1 } }, { checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection' ] } } ] } );
835
+ findAndQuery.push( { $or: [ { checkListType: { $in: [ 'custom', 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection' ] } } ] } );
835
836
  } else if ( requestData?.filter === 'question' ) {
836
837
  findAndQuery.push( { checkListType: 'custom' } );
837
838
  findAndQuery.push( { questionFlag: { $gte: 1 } } );
@@ -879,25 +880,40 @@ export const flagTablesV1 = async ( req, res ) => {
879
880
  checkListType: { $last: '$checkListType' },
880
881
  storeCount: { $sum: 1 },
881
882
  storeCountAi: { $max: '$storeCount' },
882
- flaggedStores: {
883
- $addToSet: {
884
- $cond: [
885
- {
886
- $or: [
887
- { $gt: [ '$timeFlag', 0 ] },
888
- { $gt: [ '$questionFlag', 0 ] },
889
- { $gt: [ '$mobileDetectionFlag', 0 ] },
890
- { $gt: [ '$storeOpenCloseFlag', 0 ] },
891
- { $gt: [ '$uniformDetectionFlag', 0 ] },
892
- { $gt: [ '$customerUnattended', 0 ] },
893
- { $gt: [ '$staffLeftInTheMiddle', 0 ] },
894
- ],
895
- },
896
- '$store_id',
897
- '$$REMOVE',
883
+ // flaggedStores: {
884
+ // $addToSet: {
885
+ // $cond: [
886
+ // {
887
+ // $or: [
888
+ // { $gt: [ '$timeFlag', 0 ] },
889
+ // { $gt: [ '$questionFlag', 0 ] },
890
+ // { $gt: [ '$mobileDetectionFlag', 0 ] },
891
+ // { $gt: [ '$storeOpenCloseFlag', 0 ] },
892
+ // { $gt: [ '$uniformDetectionFlag', 0 ] },
893
+ // { $gt: [ '$customerUnattended', 0 ] },
894
+ // { $gt: [ '$staffLeftInTheMiddle', 0 ] },
895
+ // ],
896
+ // },
897
+ // '$store_id',
898
+ // '$$REMOVE',
899
+ // ],
900
+ // },
901
+ // },
902
+ flaggedStores: { $sum: { $cond: [
903
+ {
904
+ $or: [
905
+ { '$gt': [ '$timeFlag', 0 ] },
906
+ { '$gt': [ '$questionFlag', 0 ] },
907
+ { '$gt': [ '$mobileDetectionFlag', 0 ] },
908
+ { '$gt': [ '$storeOpenCloseFlag', 0 ] },
909
+ { '$gt': [ '$uniformDetectionFlag', 0 ] },
910
+ { '$gt': [ '$customerUnattended', 0 ] },
911
+ { '$gt': [ '$staffLeftInTheMiddle', 0 ] },
898
912
  ],
899
913
  },
900
- },
914
+ 1,
915
+ 0,
916
+ ] } },
901
917
  flagCount: {
902
918
  $sum: {
903
919
  $add: [ '$questionFlag', '$timeFlag' ],
@@ -935,6 +951,7 @@ export const flagTablesV1 = async ( req, res ) => {
935
951
  // },
936
952
  },
937
953
  aiStoreList: { $max: '$aiStoreList' },
954
+ aiStoreListNew: { $sum: { $size: '$aiStoreList' } },
938
955
  submittedQuestionCount: {
939
956
  $sum: {
940
957
  $cond: [
@@ -950,14 +967,15 @@ export const flagTablesV1 = async ( req, res ) => {
950
967
  findQuery.push( {
951
968
  $project: {
952
969
  assignedStores: '$storeCount',
953
- assignedStoresAi: '$storeCountAi',
970
+ assignedStoresAi: '$aiStoreListNew',
954
971
  checkListName: 1,
955
972
  checkListChar: 1,
956
973
  sourceCheckList_id: 1,
957
974
  checkListType: 1,
958
975
  flagType: 1,
959
976
  uniqueFlaggedStores: 1,
960
- flaggedStores: { $size: '$flaggedStores' },
977
+ // flaggedStores: { $size: '$flaggedStores' },
978
+ flaggedStores: '$flaggedStores',
961
979
  flagCount: 1,
962
980
  questionCount: 1,
963
981
  correctAnswers: { $subtract: [ '$submittedQuestionCount', '$questionFlag' ] },