From bdc9759423e4b15204d414c3d2a880eba991ae7a Mon Sep 17 00:00:00 2001 From: anor Date: Wed, 18 Nov 2026 04:46:30 +1000 Subject: [PATCH] =?UTF-8?q?refactor(=D1=81=D1=82=D0=BE=D1=80=D0=BE=D0=B6):?= =?UTF-8?q?=20=D0=B2=D0=B0=D0=B6=D0=BD=D1=8B=D0=B5=20=D1=83=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=D0=BD=D0=B8=20=D0=BD=D0=B0=D1=85=D0=BE=D0=B4=D0=BE=D0=BA?= =?UTF-8?q?=20=E2=80=94=20=D0=BE=D0=B4=D0=B8=D0=BD=20=D1=81=D0=BF=D0=B8?= =?UTF-8?q?=D1=81=D0=BE=D0=BA=20=D0=BD=D0=B0=20=D0=BF=D0=B8=D1=81=D1=8C?= =?UTF-8?q?=D0=BC=D0=BE=20=D0=B8=20=D0=BD=D0=B0=20=D1=81=D0=BE=D1=85=D1=80?= =?UTF-8?q?=D0=B0=D0=BD=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BC=D0=B5=D1=82=D0=BE?= =?UTF-8?q?=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Находка зайки: набор ("update", "problem") был продублирован в _notify и в _run_check_body; правка в одном месте разводила тему письма и состав рассылки. Теперь IMPORTANT_LEVELS. Co-Authored-By: Claude Code --- ext_check.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ext_check.py b/ext_check.py index 63113a0..a40787a 100644 --- a/ext_check.py +++ b/ext_check.py @@ -25,6 +25,11 @@ import fgis_client as fc import pravo_client as pc +# Уровни, о которых сообщаем письмом и которые считаем «важными» в отчёте. +# Один список на оба места: иначе тема письма и состав рассылки разъезжаются. +IMPORTANT_LEVELS = ("update", "problem") + + def _regions() -> list[int]: raw = os.environ.get("EXT_REGIONS", "").strip() if raw.lower() == "all": @@ -332,7 +337,7 @@ def _notify(findings: list[dict]) -> bool: import html as _html def esc(v): return _html.escape(str(v or "")) - updates = [f for f in findings if f["level"] in ("update", "problem")] + updates = [f for f in findings if f["level"] in IMPORTANT_LEVELS] rows = "".join( f"
  • [{esc(f['level'])}] {esc(f['source'])}: {esc(f['message'])}" + (f"
    {esc(f['action'])}" if f.get("action") else "") @@ -517,7 +522,7 @@ def _run_check_body(regions: list[int] | None, *, notify: bool) -> dict: findings += f _write_report(findings, regions) - updates = [f for f in findings if f["level"] in ("update", "problem")] + updates = [f for f in findings if f["level"] in IMPORTANT_LEVELS] notify_ok = True доставлено = not updates if notify and updates: