tango-app-api-infra 3.8.1-beta.9 → 3.8.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,11 +1,11 @@
1
1
  {
2
2
  "name": "tango-app-api-infra",
3
- "version": "3.8.1-beta.9",
3
+ "version": "3.8.2",
4
4
  "description": "infra",
5
5
  "main": "index.js",
6
6
  "type": "module",
7
7
  "scripts": {
8
- "start": "nodemon --exec \"eslint --fix . && node index.js\""
8
+ "start": "nodemon --exec \"eslint --fix . && node app.js\""
9
9
  },
10
10
  "engines": {
11
11
  "node": ">=18.10.0"
@@ -27,8 +27,8 @@
27
27
  "mongodb": "^6.4.0",
28
28
  "nodemon": "^3.1.0",
29
29
  "swagger-ui-express": "^5.0.0",
30
- "tango-api-schema": "^2.2.201",
31
- "tango-app-api-middleware": "^3.1.90",
30
+ "tango-api-schema": "^2.3.8",
31
+ "tango-app-api-middleware": "^3.1.93",
32
32
  "winston": "^3.12.0",
33
33
  "winston-daily-rotate-file": "^5.0.0"
34
34
  },
@@ -1453,6 +1453,10 @@ export async function hourWiseDownstores( req, res ) {
1453
1453
  result.push( storedata[0] );
1454
1454
  }
1455
1455
  if ( req.body.export && result.length > 0 ) {
1456
+ if ( req.body.infrafilterIssue == 'Live Stores' || req.body.infrafilterIssue == 'Total Stores' ) {
1457
+ result.forEach( ( obj ) => delete obj.PrimaryIssue );
1458
+ }
1459
+ console.log( result );
1456
1460
  await download( result, res );
1457
1461
  return;
1458
1462
  }
@@ -1471,6 +1475,7 @@ async function downStoresCheck( data, inputData ) {
1471
1475
  startTime: dayjs( slot.from ).format( 'hh:mm A' ),
1472
1476
  endTime: dayjs( slot.to ).format( 'hh:mm A' ),
1473
1477
  } ) );
1478
+ let Totaldowntime=0;
1474
1479
 
1475
1480
  const downTimePromises = formattedTimeSlots.map( async ( obj ) => {
1476
1481
  const downTime = await getOpenSearchData(
@@ -1492,11 +1497,10 @@ async function downStoresCheck( data, inputData ) {
1492
1497
  const streamwiseDowntime = downTime.body.hits.hits.length > 0 ?
1493
1498
  downTime.body.hits.hits[0]._source.doc.streamwise_downtime :
1494
1499
  [];
1495
-
1496
1500
  const average = streamwiseDowntime.length ?
1497
1501
  Math.round( streamwiseDowntime.reduce( ( acc, curr ) => acc + curr.down_time, 0 ) / streamwiseDowntime.length ) :
1498
1502
  '';
1499
-
1503
+ Totaldowntime= Number( Totaldowntime ) + Number( average );
1500
1504
  return { ...obj, [`${obj.startTime}-${obj.endTime}`]: average };
1501
1505
  } );
1502
1506
 
@@ -1512,6 +1516,7 @@ async function downStoresCheck( data, inputData ) {
1512
1516
  }, {
1513
1517
  storeName: data.storeName,
1514
1518
  storeId: data.storeId,
1519
+ Totaldowntime: Totaldowntime + ' mins',
1515
1520
  PrimaryIssue: data.primaryIssue,
1516
1521
  } );
1517
1522