fix: 拆除后工参改用拆除日下一周的周一

停闭后一周的指标周三就有、下一周周一的工参周四才取,中间这一天周边站先按拆除前工参算,并在结果说明里写明。
This commit is contained in:
2026-11-12 14:57:19 +08:00
parent 62b72bb130
commit 9225d7e45b
7 changed files with 32 additions and 23 deletions
+5 -2
View File
@@ -198,8 +198,8 @@ def test_evaluate_site_finds_neighbors_and_sectors_with_mock_sources():
group = groups[0]
stages: list[str] = []
payload = evaluate_site(group, "江门", TODAY, MockGongcan(), MockMetrics(), stage=stages.append)
# 拆除前工参是拆除日上一周的周一,拆除后工参是拆除日当周的周一。
assert payload["beforeDay"] == "2026-10-05" and payload["afterDay"] == "2026-10-12" and payload["afterPresent"] is True
# 拆除前工参是拆除日上一周的周一,拆除后工参是拆除日下一周的周一。
assert payload["beforeDay"] == "2026-10-05" and payload["afterDay"] == "2026-10-19" and payload["afterPresent"] is True
assert len(payload["neighbors"]) == 3 and payload["locatable"]
assert all(item["site"] != "模拟待拆站点" for item in payload["item2"])
assert not {"460-00-5001-1", "460-00-5001-2"} & {item["cgi"] for item in payload["item2"]}
@@ -231,6 +231,9 @@ def test_evaluate_site_waits_for_weeks_the_platform_has_not_synced():
last_week = evaluate_site(low_site(date(2026, 11, 4)), "江门", TODAY, MockGongcan(), MockMetrics())
assert last_week["windows"]["after"] == ["2026-11-02", "2026-11-08"] and last_week["mrMonths"] == {"before": "2026-10", "after": None}
assert any("停闭后的 4G MR 用 2026-11 的月数据" in note and "2026-12-03" in note for note in last_week["notes"])
# 停闭后一周的指标今天(周三)有了,下一周周一 11-09 的工参明天才取。
assert last_week["afterDay"] is None and "拆除后工参用 2026-11-09 的,要到 2026-11-12 才取,周边站先按拆除前工参算" in last_week["notes"]
assert not any("拆除后工参用" in note for note in done["notes"] + this_week["notes"])
lte_rows = [item for item in last_week["item2"] if item["tech"] == "4G"]
assert last_week["mrPending"] is True and not done["mrPending"]
assert all(item["before"]["mr_weak_pct"] is not None and item["after"]["mr_weak_pct"] is None and item["after"]["traffic_gb"] is not None for item in lte_rows)