mirror of
https://github.com/eitchtee/WYGIWYH.git
synced 2026-07-12 07:42:53 +02:00
feat: convert returns None if Currency convertion has same currency for both or if amount if 0
This commit is contained in:
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user