Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

stripe: Order downgrade_small_realms_behind_on_payments_as_needed query.

Anders Kaseorgf04f3bcbfc2e
diff --git a/corporate/lib/stripe.py b/corporate/lib/stripe.py
index f4934802408..a01f0f59533 100644
--- a/corporate/lib/stripe.py
+++ b/corporate/lib/stripe.py
@@ -5702,7 +5702,9 @@ def customer_has_last_n_invoices_open(customer: Customer, n: int) -> bool:
def downgrade_small_realms_behind_on_payments_as_needed() -> None:
- customers = Customer.objects.all().exclude(stripe_customer_id=None).exclude(realm=None)
+ customers = (
+ Customer.objects.all().exclude(stripe_customer_id=None).exclude(realm=None).order_by("id")
+ )
for customer in customers:
realm = customer.realm
assert realm is not None