Skip to content

Commit 0db1e74

Browse files
authored
Merge pull request #84 from ImMin5/master
Fix exchange rate error
2 parents 97e044b + 34a178a commit 0db1e74

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/cloudforet/cost_analysis/manager/cost_manager.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,11 @@ def _get_saved_cost(self, result: dict, cost: float) -> float:
528528
cost_in_pricing_currency = self._convert_str_to_float_format(
529529
result.get("costinpricingcurrency", 0.0)
530530
)
531-
exchange_rate = cost_in_billing_currency / cost_in_pricing_currency
531+
532+
if cost_in_pricing_currency == 0 or cost_in_billing_currency == 0:
533+
exchange_rate = 0
534+
else:
535+
exchange_rate = cost_in_billing_currency / cost_in_pricing_currency
532536

533537
retail_cost = exchange_rate * quantity * unit_price
534538
if retail_cost:

0 commit comments

Comments
 (0)