tango-app-api-store-builder 1.0.3 → 1.0.4
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
|
@@ -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
|
-
|
|
7585
|
+
// function formatPercentage( value ) {
|
|
7586
|
+
// if ( value >= 100 ) return 100;
|
|
7587
7587
|
|
|
7588
|
-
|
|
7588
|
+
// const truncated = Math.floor( value * 10 ) / 10;
|
|
7589
7589
|
|
|
7590
|
-
|
|
7591
|
-
}
|
|
7590
|
+
// return Number.isInteger( truncated ) ? Math.trunc( truncated ) : truncated;
|
|
7591
|
+
// }
|
|
7592
7592
|
if ( totalProducts.length ) {
|
|
7593
|
-
result.merchCompliance =
|
|
7594
|
-
let previousMerchCompliance = getCompliance?.[1]?.count ?
|
|
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 =
|
|
7598
|
+
result.previousMerchCompliance = diff;
|
|
7599
7599
|
result.rateIncrease = true;
|
|
7600
7600
|
} else {
|
|
7601
7601
|
let diff = previousMerchCompliance - result.merchCompliance;
|
|
7602
|
-
result.previousMerchCompliance =
|
|
7602
|
+
result.previousMerchCompliance = diff;
|
|
7603
7603
|
result.rateIncrease = false;
|
|
7604
7604
|
}
|
|
7605
7605
|
}
|