tango-app-api-audit 3.4.3-alpha.8 → 3.4.3-alpha.9

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-audit",
3
- "version": "3.4.3-alpha.8",
3
+ "version": "3.4.3-alpha.9",
4
4
  "description": "audit & audit metrics apis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -3568,6 +3568,46 @@ export async function totalNotAssignedCount( req, res ) {
3568
3568
  },
3569
3569
  },
3570
3570
  ];
3571
+
3572
+ const mappingInprogressCount = [
3573
+ {
3574
+ $match: {
3575
+ fileDate: { $eq: latestDate },
3576
+ },
3577
+ },
3578
+ {
3579
+ $project: {
3580
+ inprogressAuditCount: {
3581
+ $cond: [
3582
+ { $in: [ '$status', [ 'completed', 'not_assign', 'skipped' ] ] }, 1, 0,
3583
+ ],
3584
+ },
3585
+ inprogressTraxCount: {
3586
+ $cond: [
3587
+ { $and: [ { $in: [ '$status', [ 'completed', 'not_assign', 'skipped' ] ] } ] }, 1, 0,
3588
+ ],
3589
+ },
3590
+
3591
+ },
3592
+ },
3593
+ {
3594
+ $group: {
3595
+ _id: null,
3596
+ inprogressAuditCount: { $sum: '$inprogressAuditCount' },
3597
+ inprogressZoneCount: { $sum: '$inprogressZoneCount' },
3598
+ inprogressTrafficCount: { $sum: '$inprogressTrafficCount' },
3599
+
3600
+ },
3601
+ },
3602
+ {
3603
+ $project: {
3604
+ _id: 0,
3605
+ inprogressAuditCount: { $ifNull: [ '$inprogressAuditCount', 0 ] },
3606
+ inprogressZoneCount: { $ifNull: [ '$inprogressZoneCount', 0 ] },
3607
+ inprogressTrafficCount: { $ifNull: [ '$inprogressTrafficCount', 0 ] },
3608
+ },
3609
+ },
3610
+ ];
3571
3611
  // const binaryInprogressCount=[
3572
3612
  // {
3573
3613
  // $match: {
@@ -3652,6 +3692,7 @@ export async function totalNotAssignedCount( req, res ) {
3652
3692
  const getTotalTraxAudit = await aggregateTraxAuditData( traxQuery );
3653
3693
  const getInprogressCount = await aggregateStoreAudit( inprogressCount );
3654
3694
  const getBinaryInprogressCount = await aggregateBinaryAudit( binaryInprogressCount );
3695
+ const getMappingInprogressCount = await aggregateStoreEmpDetection( mappingInprogressCount );
3655
3696
  // const getMappingInprogressCount = await aggregateStoreEmpDetection( mappingInprogressCount );
3656
3697
  if ( getTotalcount.length == 0 && getTotalTraxAudit.length == 0 ) {
3657
3698
  return res.sendError( 'No Data Found', 204 );
@@ -3672,6 +3713,12 @@ export async function totalNotAssignedCount( req, res ) {
3672
3713
  } else {
3673
3714
  notAssignedCount.totalTraxAuditCount = getTotalTraxAudit[0]?.totalTraxAuditCount;
3674
3715
  }
3716
+
3717
+ if ( getMappingInprogressCount.length > 0 ) {
3718
+ notAssignedCount.totalTraxAuditCount = getTotalTraxAudit[0].totalTraxAuditCount > getMappingInprogressCount[0].inprogressTraxCount ? getTotalTraxAudit[0].totalTraxAuditCount - getMappingInprogressCount[0].inprogressTraxCount : 0;
3719
+ } else {
3720
+ notAssignedCount.totalTraxAuditCount = getTotalTraxAudit[0]?.totalTraxAuditCount;
3721
+ }
3675
3722
  return res.sendSuccess( { result: notAssignedCount } );
3676
3723
  } catch ( error ) {
3677
3724
  const err = error.message || 'Internal Server Error';