diff --git a/pricing/pricing.py b/pricing/pricing.py index 0188bee..1cccd30 100644 --- a/pricing/pricing.py +++ b/pricing/pricing.py @@ -483,10 +483,11 @@ class PricingProgram: async def buffered_charging(ppid, data): r = await PricingProgram.get_ppid_pricing(ppid) prices = PricingProgram.get_pricing_from_ymalstr(data, - r.pricing_data) + r.pricing_data) amt = 0.0 + discount = max(0.0, min(1.0, r.discount)) if r.discount is not None else 1.0 for p in prices: - p.cost = p.amount * r.discount + p.cost = p.amount * discount return prices async def charging(sor, ppid, data): @@ -518,8 +519,9 @@ order by b.enabled_date desc""" r.pricing_data) debug(f'{r.prices=}') amt = 0.0 + discount = max(0.0, min(1.0, r.discount)) if r.discount is not None else 1.0 for p in r.prices: - p.cost = p.amount * r.discount + p.cost = p.amount * discount return r.prices @staticmethod