From 616c3a1926280debbee5c77f70775a0fbe97f87d Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Tue, 16 Jun 2026 10:45:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BE=9B=E5=BA=94=E5=95=86=E6=8A=98?= =?UTF-8?q?=E6=89=A3=E8=B4=9F=E6=95=B0=E6=A0=A1=E9=AA=8C=EF=BC=8Cclamp?= =?UTF-8?q?=E5=88=B00~1=E8=8C=83=E5=9B=B4(bug6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pricing/pricing.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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