summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2023-06-23 16:55:42 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2023-06-23 16:55:42 +0700
commit6fbfc93c2297bfa4dcf870ec4d57017d602a5f27 (patch)
treeb17bc7a71bb7643ab9f7290f42d42598c25ec11c
parent80da0a90852cc589f5e2f10cc1b7df1c48ddb0b2 (diff)
Fix used_percentage on program line response
-rw-r--r--indoteknik_custom/models/promotion_program_line.py4
1 files 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)
}