From b0eb28618c23de02fd9797b64705c5a65517813f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Mon, 11 Nov 2024 00:44:47 +0100 Subject: [PATCH] Uppercase currency instead of lowercase --- games/convert_price.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/games/convert_price.py b/games/convert_price.py index de373d2..815b3a0 100644 --- a/games/convert_price.py +++ b/games/convert_price.py @@ -4,7 +4,7 @@ from games.models import ExchangeRate, Purchase # fixme: save preferred currency in user model currency_to = "CZK" -currency_to = currency_to.lower() +currency_to = currency_to.upper() def save_converted_info(purchase, converted_price, converted_currency): @@ -22,13 +22,11 @@ def update_converted_prices(): ) for purchase in purchases: - if purchase.price_currency.lower() == currency_to or purchase.price == 0: - save_converted_info( - purchase, purchase.price, purchase.price_currency.lower() - ) + if purchase.price_currency.upper() == currency_to or purchase.price == 0: + save_converted_info(purchase, purchase.price, currency_to) continue year = purchase.date_purchased.year - currency_from = purchase.price_currency.lower() + currency_from = purchase.price_currency.upper() exchange_rate = ExchangeRate.objects.filter( currency_from=currency_from, currency_to=currency_to, year=year ).first()