Skip to content

Commit

Permalink
fix inaccuracy in send_upcoming_debit_notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
Changaco committed Sep 16, 2023
1 parent 91961c1 commit 4ac5458
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions liberapay/payin/cron.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,18 +211,20 @@ def send_upcoming_debit_notifications():
max_execution_date = max(sp['execution_date'] for sp in payins)
assert last_execution_date == max_execution_date
context['ndays'] = (max_execution_date - utcnow().date()).days
currency = payins[0]['amount'].currency
while True:
route = db.one("""
SELECT r
FROM exchange_routes r
WHERE r.participant = %s
AND r.status = 'chargeable'
AND r.network::text LIKE 'stripe-%%'
ORDER BY r.is_default NULLS LAST
ORDER BY r.is_default_for = %s DESC NULLS LAST
, r.is_default NULLS LAST
, r.network = 'stripe-sdd' DESC
, r.ctime DESC
LIMIT 1
""", (payer.id,))
""", (payer.id, currency))
if route is None:
break
route.sync_status()
Expand Down

0 comments on commit 4ac5458

Please sign in to comment.