fix(douyu): 拆分账号资格活动窗口与库存语义

This commit is contained in:
yml
2026-11-22 20:04:49 +08:00
parent d78437c6ac
commit 1906f924bc
26 changed files with 896 additions and 174 deletions
@@ -22,8 +22,8 @@ from .account_query_filters import (
assigned_to_pool_filter,
automatable_account_filter,
cookie_present_filter,
fresh_available_state_filter,
fresh_ck_cutoff,
fresh_eligible_state_filter,
role_change_ready_filter,
valid_ck_filter,
)
@@ -128,8 +128,8 @@ def _allocatable_filter(now: datetime):
)
def _fresh_available_filter(now: datetime):
return fresh_available_state_filter(now)
def _fresh_eligible_filter(now: datetime):
return fresh_eligible_state_filter(now, allow_before_open=True)
def _commodity_query(
@@ -230,7 +230,7 @@ def _global_inventory_totals(
base_filter,
AccountCommodityState.platform == platform,
AccountCommodityState.scope == scope,
_fresh_available_filter(now),
_fresh_eligible_filter(now),
)
.group_by(value_class)
.all()
@@ -297,7 +297,7 @@ def evaluate_supply_target(
if target.commodity_id:
base = _commodity_query(db, now=moment, target=target)
covered = base.count()
available_query = base.filter(_fresh_available_filter(moment))
available_query = base.filter(_fresh_eligible_filter(moment))
available = available_query.count()
allocatable = available_query.filter(_allocatable_filter(moment)).count()
else: