diff --git a/gratipay/billing/exchanges.py b/gratipay/billing/exchanges.py index 0b2ed6856d..28f0fde0b0 100644 --- a/gratipay/billing/exchanges.py +++ b/gratipay/billing/exchanges.py @@ -198,12 +198,20 @@ def get_ready_payout_routes_by_network(db, network): ) > 0 - OR -- Include green-lit Gratipay 1.0 balances + OR -- Include team members + + (SELECT count(*) + FROM current_takes ct + JOIN teams t ON ct.team_id = t.id + WHERE ct.participant_id = p.id + AND t.is_approved IS TRUE + AND t.is_closed IS NOT TRUE + ) > 0 - p.status_of_1_0_payout='pending-payout' + OR -- Include green-lit Gratipay 1.0 balances - ----- TODO: Include team members once process_takes is implemented + p.status_of_1_0_payout='pending-payout' ) """, (network,))