Uppercase currency instead of lowercase

This commit is contained in:
Lukáš Kucharczyk 2024-11-11 00:44:47 +01:00
parent b05a0bd502
commit b0eb28618c
Signed by: lukas
SSH Key Fingerprint: SHA256:vMuSwvwAvcT6htVAioMP7rzzwMQNi3roESyhv+nAxeg
1 changed files with 4 additions and 6 deletions

View File

@ -4,7 +4,7 @@ from games.models import ExchangeRate, Purchase
# fixme: save preferred currency in user model # fixme: save preferred currency in user model
currency_to = "CZK" currency_to = "CZK"
currency_to = currency_to.lower() currency_to = currency_to.upper()
def save_converted_info(purchase, converted_price, converted_currency): def save_converted_info(purchase, converted_price, converted_currency):
@ -22,13 +22,11 @@ def update_converted_prices():
) )
for purchase in purchases: for purchase in purchases:
if purchase.price_currency.lower() == currency_to or purchase.price == 0: if purchase.price_currency.upper() == currency_to or purchase.price == 0:
save_converted_info( save_converted_info(purchase, purchase.price, currency_to)
purchase, purchase.price, purchase.price_currency.lower()
)
continue continue
year = purchase.date_purchased.year year = purchase.date_purchased.year
currency_from = purchase.price_currency.lower() currency_from = purchase.price_currency.upper()
exchange_rate = ExchangeRate.objects.filter( exchange_rate = ExchangeRate.objects.filter(
currency_from=currency_from, currency_to=currency_to, year=year currency_from=currency_from, currency_to=currency_to, year=year
).first() ).first()