Skip to content

Commit

Permalink
round monthly traffic price
Browse files Browse the repository at this point in the history
  • Loading branch information
daroczig committed Sep 11, 2024
1 parent ec9161e commit cbd23aa
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/sc_keeper/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -753,11 +753,11 @@ def search_traffic_prices(
# update prices per tiers and to currency requested
for price in prices:

def rounder(p):
return round(p, 6)

def local_price(p):
return round(
currency_converter.convert(p, price.currency, currency),
6,
)
return rounder(currency_converter.convert(p, price.currency, currency))

if currency:
if hasattr(price, "price") and hasattr(price, "currency"):
Expand All @@ -774,9 +774,9 @@ def local_price(p):
max(monthly_traffic - traffic_paid, 0),
(float(tier.upper) - float(tier.lower)),
)
price.price_monthly_traffic += tier.price * traffic_tier
price.price_monthly_traffic += rounder(tier.price * traffic_tier)
traffic_paid += traffic_tier
else:
price.price_monthly_traffic = price.price * monthly_traffic
price.price_monthly_traffic = rounder(price.price * monthly_traffic)

return prices

0 comments on commit cbd23aa

Please sign in to comment.