From 6fbfc93c2297bfa4dcf870ec4d57017d602a5f27 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Fri, 23 Jun 2023 16:55:42 +0700 Subject: Fix used_percentage on program line response --- indoteknik_custom/models/promotion_program_line.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indoteknik_custom/models/promotion_program_line.py b/indoteknik_custom/models/promotion_program_line.py index e300a5d1..3ab9b2c0 100644 --- a/indoteknik_custom/models/promotion_program_line.py +++ b/indoteknik_custom/models/promotion_program_line.py @@ -131,7 +131,7 @@ class PromotionProgramLine(models.Model): product_price = self.product_id.calculate_website_price() limit_qty = self._res_limit_qty() remaining_qty = self._get_remaining_qty(user) - percent_remaining = (remaining_qty['all'] - limit_qty['all']) / remaining_qty['all'] + percent_remaining = (limit_qty['all'] - remaining_qty['all']) / limit_qty['all'] * 100 return { 'id': self.id, 'name': self.name, @@ -142,7 +142,7 @@ class PromotionProgramLine(models.Model): 'type': self._res_promotion_type(), 'limit_qty': limit_qty, 'remaining_qty': remaining_qty, - 'percent_remaining': percent_remaining, + 'used_percentage': percent_remaining, 'price': self.calculate_price(price=product_price) } -- cgit v1.2.3