Skip to content

Commit

Permalink
fix json loading
Browse files Browse the repository at this point in the history
  • Loading branch information
madisvain committed Aug 29, 2023
1 parent 1de81a1 commit d9ca374
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,13 +283,12 @@ async def rates(request):
.order_by(Rates.c.date.desc())
.limit(1)
)
record_rates = json.loads(record.rates)

# Base re-calculation
rates = {"EUR": 1}
rates.update(record_rates)
rates.update(record.rates)
if query.base and query.base != "EUR":
base_rate = Decimal(record_rates[query.base])
base_rate = Decimal(record.rates[query.base])
rates = {
currency: Decimal(rate) / base_rate for currency, rate in rates.items()
}
Expand Down

1 comment on commit d9ca374

@vercel
Copy link

@vercel vercel bot commented on d9ca374 Aug 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.