tango-app-api-store-builder 1.0.0-beta-227 → 1.0.1

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.0-beta-227",
3
+ "version": "1.0.1",
4
4
  "description": "storeBuilder",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -7152,7 +7152,7 @@ export async function calculateCompliance( req, res ) {
7152
7152
  let result = {
7153
7153
  merchCompliance: 0,
7154
7154
  previousMerchCompliance: 0,
7155
- rateIncrease: false,
7155
+ rateIncrease: null,
7156
7156
  lastCheck: null,
7157
7157
  };
7158
7158
  if ( getCompliance.length ) {
@@ -7180,13 +7180,16 @@ export async function calculateCompliance( req, res ) {
7180
7180
  if ( totalProducts.length ) {
7181
7181
  result.merchCompliance = Math.floor( ( getCompliance?.[0]?.count / totalProducts?.[0]?.productCount ) * 100 );
7182
7182
  let previousMerchCompliance = getCompliance?.[1]?.count ? Math.floor( ( getCompliance?.[1]?.count / totalProducts?.[0]?.productCount ) * 100 ) : 0;
7183
- if ( result.merchCompliance > previousMerchCompliance ) {
7184
- let diff = result.merchCompliance - previousMerchCompliance;
7185
- result.previousMerchCompliance = diff;
7186
- result.rateIncrease = true;
7187
- } else {
7188
- let diff = previousMerchCompliance - result.merchCompliance;
7189
- result.previousMerchCompliance = diff;
7183
+ if ( totalProducts.length > 1 ) {
7184
+ if ( result.merchCompliance > previousMerchCompliance ) {
7185
+ let diff = result.merchCompliance - previousMerchCompliance;
7186
+ result.previousMerchCompliance = diff;
7187
+ result.rateIncrease = true;
7188
+ } else {
7189
+ let diff = previousMerchCompliance - result.merchCompliance;
7190
+ result.previousMerchCompliance = diff;
7191
+ result.rateIncrease = false;
7192
+ }
7190
7193
  }
7191
7194
  result.lastCheck = dayjs( getCompliance?.[0]?.date ).format( 'hh:mm A' );
7192
7195
  }