BETTERZON-42: Fixing amazon price difference percentage

This commit is contained in:
Patrick Müller 2020-12-09 21:33:37 +01:00
parent 31423c630a
commit ab277b3311

View File

@ -111,12 +111,8 @@ export class ProductDetailsComponent implements OnInit {
const amazonPrice = this.currentAmazonPrice?.price_in_cents; const amazonPrice = this.currentAmazonPrice?.price_in_cents;
const lowestPrice = this.currentlyLowestPrice?.price_in_cents; const lowestPrice = this.currentlyLowestPrice?.price_in_cents;
const percentage = amazonPrice / lowestPrice; const percentage = ((amazonPrice / lowestPrice) - 1) * 100;
if (percentage < 1) { return Math.round(percentage);
return -Math.round(percentage);
} else {
return +Math.round(percentage);
}
} }
} }