tango-app-api-store-builder 1.0.3 → 1.0.5

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-store-builder",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "storeBuilder",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -32,7 +32,7 @@
32
32
  "path": "^0.12.7",
33
33
  "selenium-webdriver": "^4.31.0",
34
34
  "sharp": "^0.34.1",
35
- "tango-api-schema": "^2.4.18",
35
+ "tango-api-schema": "^2.4.31",
36
36
  "tango-app-api-middleware": "3.1.48",
37
37
  "url": "^0.11.4",
38
38
  "winston": "^3.17.0",
@@ -3572,7 +3572,7 @@ export async function storeFixturesTaskv2( req, res ) {
3572
3572
 
3573
3573
  if ( !planograms?.length ) return res.sendError( 'No data found', 204 );
3574
3574
 
3575
-
3575
+ const currentDate = new Date( dayjs().format( 'YYYY-MM-DD' ) );
3576
3576
  const storeLayout = await Promise.all(
3577
3577
  planograms.map( async ( planogram ) => {
3578
3578
  const floors = await storeBuilderService.find(
@@ -3640,7 +3640,7 @@ export async function storeFixturesTaskv2( req, res ) {
3640
3640
  },
3641
3641
  },
3642
3642
  {
3643
- $sort: { $_id: -1 },
3643
+ $sort: { _id: -1 },
3644
3644
  },
3645
3645
  {
3646
3646
  $limit: 1,
@@ -3771,7 +3771,7 @@ export async function storeFixturesTaskv2( req, res ) {
3771
3771
  },
3772
3772
  },
3773
3773
  {
3774
- $sort: { $_id: -1 },
3774
+ $sort: { _id: -1 },
3775
3775
  },
3776
3776
  {
3777
3777
  $limit: 1,
@@ -7582,24 +7582,24 @@ export async function calculateCompliance( req, res ) {
7582
7582
  },
7583
7583
  ];
7584
7584
  let totalProducts = await storeFixtureService.aggregate( productCountQuery );
7585
- function formatPercentage( value ) {
7586
- if ( value >= 100 ) return 100;
7585
+ // function formatPercentage( value ) {
7586
+ // if ( value >= 100 ) return 100;
7587
7587
 
7588
- const truncated = Math.floor( value * 10 ) / 10;
7588
+ // const truncated = Math.floor( value * 10 ) / 10;
7589
7589
 
7590
- return Number.isInteger( truncated ) ? Math.trunc( truncated ) : truncated;
7591
- }
7590
+ // return Number.isInteger( truncated ) ? Math.trunc( truncated ) : truncated;
7591
+ // }
7592
7592
  if ( totalProducts.length ) {
7593
- result.merchCompliance =formatPercentage( ( getCompliance?.[0]?.count / totalProducts?.[0]?.productCount ) * 100 );
7594
- let previousMerchCompliance = getCompliance?.[1]?.count ? formatPercentage( ( getCompliance?.[1]?.count / totalProducts?.[0]?.productCount ) * 100 ) : 0;
7593
+ result.merchCompliance = ( ( getCompliance?.[0]?.count / totalProducts?.[0]?.productCount ) * 100 ).toFixed( 1 );
7594
+ let previousMerchCompliance = getCompliance?.[1]?.count ? ( ( getCompliance?.[1]?.count / totalProducts?.[0]?.productCount ) * 100 ).toFixed( 1 ) : 0;
7595
7595
  if ( getCompliance.length > 1 && result.merchCompliance != previousMerchCompliance ) {
7596
7596
  if ( result.merchCompliance > previousMerchCompliance ) {
7597
7597
  let diff = result.merchCompliance - previousMerchCompliance;
7598
- result.previousMerchCompliance = formatPercentage( diff );
7598
+ result.previousMerchCompliance = diff;
7599
7599
  result.rateIncrease = true;
7600
7600
  } else {
7601
7601
  let diff = previousMerchCompliance - result.merchCompliance;
7602
- result.previousMerchCompliance = formatPercentage( diff );
7602
+ result.previousMerchCompliance = diff;
7603
7603
  result.rateIncrease = false;
7604
7604
  }
7605
7605
  }