feat: convert returns None if Currency convertion has same currency for both or if amount if 0

This commit is contained in:
Herculino Trotta
2024-11-16 23:59:46 -03:00
parent 2b8e8408e3
commit 2623fb3da5
3 changed files with 12 additions and 14 deletions
+4 -6
View File
@@ -43,12 +43,10 @@ def get_exchange_rate(
def convert(amount, from_currency: Currency, to_currency: Currency, date=None):
if from_currency == to_currency:
return (
amount,
to_currency.prefix,
to_currency.suffix,
to_currency.decimal_places,
)
return None, None, None, None
if amount == 0:
return None, None, None, None
if date is None:
date = timezone.localtime(timezone.now())