From 433837c2feaf0e5e540e4dfe6bde8e10f5091e9c Mon Sep 17 00:00:00 2001 From: phzhik Date: Wed, 11 Oct 2023 22:48:13 +0400 Subject: [PATCH] * Updated commission logic --- store/models.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/store/models.py b/store/models.py index a638ea4..90f4d0c 100644 --- a/store/models.py +++ b/store/models.py @@ -459,14 +459,14 @@ class Checklist(models.Model): if self.price_snapshot_id: return self.price_snapshot.commission_rub - commission = (self.price_rub * Decimal(settings.COMMISSION_OVER_150K) - if self.price_rub > 150_000 - else GlobalSettings.load().commission_rub) - - # Add commission of bottom-most category - if self.category_id: + if self.price_rub > 150_000: + commission = self.price_rub * Decimal(settings.COMMISSION_OVER_150K) + elif self.category_id: + # Add commission of bottom-most category category_commission = getattr(self.category, 'commission', 0) - commission += category_commission * self.price_rub / 100 + commission = self.price_rub / 100 * category_commission + else: + commission = GlobalSettings.load().commission_rub return commission