fix(supply): 有效 CK 即可用并修复自动化页空注册表
- 供给覆盖/候选取消 24h CK 新鲜度硬门槛,有效 CK 直接可用 - Web/API 进程登记作业注册表,修复作业配置/运行记录空白 - 补充有效 CK、空注册表回归测试 - 文档记录 CK 获取/首次登录缺口
This commit is contained in:
@@ -887,3 +887,54 @@ def test_supply_replenishment_skips_allocatable_only_shortage(db):
|
||||
assert result.capacity_shortages == 1
|
||||
assert result.queued == 0
|
||||
assert db.query(AccountWorkItem).count() == 0
|
||||
|
||||
|
||||
def test_valid_ck_older_than_24h_counts_in_supply_coverage(db):
|
||||
account = _account("supply-old-valid-covered", points=400)
|
||||
account.ck_checked_at = NOW - timedelta(days=3)
|
||||
db.add(account)
|
||||
db.flush()
|
||||
db.add_all(
|
||||
[
|
||||
_state(account),
|
||||
AccountSupplyTarget(
|
||||
platform="douyu",
|
||||
scope="elite",
|
||||
commodity_id="C",
|
||||
value_class=VALUE_HIGH,
|
||||
target_covered=1,
|
||||
target_available=1,
|
||||
target_allocatable=0,
|
||||
),
|
||||
]
|
||||
)
|
||||
db.commit()
|
||||
target = db.query(AccountSupplyTarget).one()
|
||||
|
||||
inventory = evaluate_supply_target(db, target, now=NOW)
|
||||
|
||||
assert inventory.covered == 1
|
||||
assert inventory.available == 1
|
||||
|
||||
|
||||
def test_valid_ck_older_than_24h_is_still_a_sync_candidate(db):
|
||||
account = _account("supply-old-valid-candidate", points=400)
|
||||
account.ck_checked_at = NOW - timedelta(days=3)
|
||||
db.add(account)
|
||||
db.flush()
|
||||
db.add(
|
||||
AccountSupplyTarget(
|
||||
platform="douyu",
|
||||
scope="elite",
|
||||
commodity_id="C",
|
||||
value_class=VALUE_HIGH,
|
||||
target_covered=1,
|
||||
target_available=1,
|
||||
target_allocatable=0,
|
||||
)
|
||||
)
|
||||
db.commit()
|
||||
|
||||
result = enqueue_supply_replenishment(db, now=NOW, max_per_target=10)
|
||||
|
||||
assert result.queued == 1
|
||||
|
||||
Reference in New Issue
Block a user