Merge remote-tracking branch 'origin/sub_desktop_1' into sub_laptop_3
This commit is contained in:
@@ -304,6 +304,34 @@ def complete_old(folder: Path) -> bool:
|
||||
return True
|
||||
|
||||
|
||||
#: 「연결된 사본」 부분 이름 → 파일(있는 것만 `부분` 에 담음)
|
||||
LINKED_PARTS = (("도면", "도면.json"), ("면적", "면적.json"), ("일위대가", LABOR_FILE))
|
||||
|
||||
|
||||
def linked_snapshots(project_root: str | Path) -> dict[str, dict[str, Any]]:
|
||||
"""연결된 사본 — 지정 ∩ 같은 항목 사본 `{구조물 id: {항목, 폴더, 부분, 경로}}`(PLAN 143-1).
|
||||
|
||||
구조물 id = `assignments` 키(관 지점 `pipe@측점` · 옵션 그룹 `{id}__{그룹}`) ·
|
||||
미지정 · 사본 없음 · 다른 항목 사본은 안 담음(M02 `assign_items` 규칙) ·
|
||||
원본 층과 대조 안 함(빠른 읽기 · 쓰기 없음) ·
|
||||
`경로` = manifest 원본 경로(가져온 때 M02 구분 · 이름) · B08 · B09 공용.
|
||||
"""
|
||||
base = structures_dir(project_root)
|
||||
found: dict[str, dict[str, Any]] = {}
|
||||
for owner, item in assignments(project_root).items():
|
||||
folder = base / folder_name(owner)
|
||||
manifest = read_json(folder / MANIFEST_NAME)
|
||||
if not same_item(manifest, item):
|
||||
continue
|
||||
found[owner] = {
|
||||
"항목": item,
|
||||
"폴더": folder.name,
|
||||
"부분": [part for part, name in LINKED_PARTS if (folder / name).is_file()],
|
||||
"경로": list(manifest["원본"].get("경로") or []),
|
||||
}
|
||||
return found
|
||||
|
||||
|
||||
def read_snapshot(project_root: str | Path, owner_id: str) -> dict[str, Any] | None:
|
||||
"""그 구조물 복사본의 `집계.json`(`{줄, 열}`) — 없으면 None(옛 항목 폴더는 먼저 옮겨 받음)."""
|
||||
if items_dir(project_root).is_dir():
|
||||
|
||||
Reference in New Issue
Block a user