mirror of
https://github.com/brmlab/brmbar.git
synced 2025-06-08 13:24:01 +02:00
brmbar.Currency.convert(): Use _latest_ exchange rate, not earliest
This commit is contained in:
parent
0ab5e579c7
commit
072aa83479
1 changed files with 1 additions and 1 deletions
|
@ -63,7 +63,7 @@ class Currency:
|
|||
|
||||
def convert(self, amount, target):
|
||||
with closing(self.db.cursor()) as cur:
|
||||
cur.execute("SELECT rate, rate_dir FROM exchange_rates WHERE target = %s AND source = %s AND valid_since <= NOW() ORDER BY valid_since ASC LIMIT 1", [target.id, self.id])
|
||||
cur.execute("SELECT rate, rate_dir FROM exchange_rates WHERE target = %s AND source = %s AND valid_since <= NOW() ORDER BY valid_since DESC LIMIT 1", [target.id, self.id])
|
||||
res = cur.fetchone()
|
||||
if res is None:
|
||||
raise NameError("Currency.convert(): Unknown conversion " + self.name() + " to " + other.name())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue