get_currencies can exclude no_currency

This commit is contained in:
Adrien CLERC 2020-05-04 19:13:46 +02:00
parent 6095f29910
commit e2159b52a6

View file

@ -25,8 +25,12 @@ class CurrencyConverter(object, metaclass=Singleton):
rates[self.no_currency] = 1.0
return rates
def get_currencies(self):
rates = [rate for rate in self.get_rates()]
def get_currencies(self, with_no_currency=True):
rates = [
rate
for rate in self.get_rates()
if with_no_currency or rate != self.no_currency
]
rates.sort(key=lambda rate: "" if rate == self.no_currency else rate)
return rates