fix: 设备验收预警优化
This commit is contained in:
1 parent
7e7bcbd388
commit
b8cc0cbe77
25 files changed
+1398
-193
No files matched your search
@@ -11,20 +11,31 @@ from __future__ import annotations
|
||||
from typing import Any
|
||||
|
||||
|
||||
def due_tiers(dwell_days: int | None, thresholds: tuple[int, int, int, int]) -> list[int]:
|
||||
def due_tiers(
|
||||
dwell_days: int | None,
|
||||
thresholds: tuple[int, int, int, int],
|
||||
*,
|
||||
max_tier: int = 4,
|
||||
) -> list[int]:
|
||||
"""
|
||||
按累计天数给出已经跨过的档位。
|
||||
|
||||
核心逻辑:需求是「超过 N 天」。停留刚好等于阈值时还不发。四档各自独立,一次可以跨多档。
|
||||
第 4 轮关闭时最高只到第 3 档,超过第 4 档天数也不产生总经理那一轮。
|
||||
Args:
|
||||
dwell_days: 签核自然日。没有计时起点时为空。
|
||||
thresholds: 四个天数,对应第 1 到第 4 档。
|
||||
max_tier: 允许的最高档,1 到 4。第 4 轮未启用时传 3。
|
||||
Returns:
|
||||
档位号 1 到 4 的列表。没有跨档时为空。
|
||||
档位号列表。没有跨档时为空。
|
||||
"""
|
||||
if dwell_days is None:
|
||||
return []
|
||||
return [index + 1 for index, day in enumerate(thresholds) if dwell_days > day]
|
||||
return [
|
||||
index + 1
|
||||
for index, day in enumerate(thresholds)
|
||||
if dwell_days > day and index + 1 <= max_tier
|
||||
]
|
||||
|
||||
|
||||
def make_person(
|
||||
|
||||
Reference in new issue
Block a user