diff --git a/complaints.py b/complaints.py index 7317106..baa5c6d 100644 --- a/complaints.py +++ b/complaints.py @@ -126,14 +126,16 @@ def apply_to_registry(path: str | Path, out_path: str | Path) -> dict: ws = _open_registry_sheet(wb) cells_filled = 0 - smety_matched = set() + smety_matched: set[str] = set() for r_idx in range(2, ws.max_row + 1): code_cell = ws.cell(row=r_idx, column=REGISTRY_CODE_COL) code = code_cell.value if not code: continue code = str(code).strip() - if code in by_smeta_str: + # one смета → пишем только в первую её строку; дубликаты ниже + # (R3/R4 для одного и того же кода) оставляем пустыми + if code in by_smeta_str and code not in smety_matched: ws.cell(row=r_idx, column=REGISTRY_TARGET_COL, value=by_smeta_str[code]) cells_filled += 1 smety_matched.add(code)