From ab277b3311fa552400606ed1125b8af49e764276 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20M=C3=BCller?= Date: Wed, 9 Dec 2020 21:33:37 +0100 Subject: [PATCH] BETTERZON-42: Fixing amazon price difference percentage --- .../product-details/product-details.component.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Frontend/src/app/components/product-details/product-details.component.ts b/Frontend/src/app/components/product-details/product-details.component.ts index fa9e87d..9c18988 100644 --- a/Frontend/src/app/components/product-details/product-details.component.ts +++ b/Frontend/src/app/components/product-details/product-details.component.ts @@ -111,12 +111,8 @@ export class ProductDetailsComponent implements OnInit { const amazonPrice = this.currentAmazonPrice?.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); - } else { - return +Math.round(percentage); - } + return Math.round(percentage); } }