修复(账号选号): 已分配账号不再进入自动选号池

自动选号只允许未归属账号;已分配给客服、运营或管理员的账号必须先释放归属,才能重新参与自动选号。
This commit is contained in:
yml
2026-11-26 20:51:08 +08:00
parent 47cc15f8ad
commit 174ae23ac1
3 changed files with 13 additions and 26 deletions
+9 -9
View File
@@ -200,21 +200,21 @@ def test_stale_supply_snapshot_is_rebuilt(db):
assert snapshot.checked_at == later
def test_supply_allocatable_uses_the_same_pool_owner_filter_as_selection(db):
customer = User(
username="supply-customer",
def test_supply_allocatable_excludes_accounts_assigned_to_support(db):
support = User(
username="supply-support",
password_hash="h",
role="customer",
role="support",
is_active=True,
)
free = _account("supply-pool-free", points=400)
customer_assigned = _account("supply-customer-assigned", points=400)
db.add(customer)
support_assigned = _account("supply-support-assigned", points=400)
db.add(support)
db.flush()
customer_assigned.assigned_to = customer.id
db.add_all([free, customer_assigned])
support_assigned.assigned_to = support.id
db.add_all([free, support_assigned])
db.flush()
db.add_all([_state(free), _state(customer_assigned)])
db.add_all([_state(free), _state(support_assigned)])
db.add(
AccountSupplyTarget(
platform="douyu",