Skip to content

Commit

Permalink
Merge pull request #84 from ImMin5/master
Browse files Browse the repository at this point in the history
Fix exchange rate error
  • Loading branch information
ImMin5 authored Aug 6, 2024
2 parents 97e044b + 34a178a commit 0db1e74
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/cloudforet/cost_analysis/manager/cost_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,11 @@ def _get_saved_cost(self, result: dict, cost: float) -> float:
cost_in_pricing_currency = self._convert_str_to_float_format(
result.get("costinpricingcurrency", 0.0)
)
exchange_rate = cost_in_billing_currency / cost_in_pricing_currency

if cost_in_pricing_currency == 0 or cost_in_billing_currency == 0:
exchange_rate = 0
else:
exchange_rate = cost_in_billing_currency / cost_in_pricing_currency

retail_cost = exchange_rate * quantity * unit_price
if retail_cost:
Expand Down

0 comments on commit 0db1e74

Please sign in to comment.