fix(M02): 표준 표 고친 값 = _standard/ 파일에 바로 · 로직 목록 시험이 자체 파일 차례에 안 기댐(사용자 결정)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KmELpdXFDRZHhfbGuRhSmL
This commit is contained in:
2026-10-02 07:57:58 +09:00
co-authored by Claude Opus 5.5
parent cc4b6a6674
commit 8fed757fc1
4 changed files with 27 additions and 17 deletions
+9 -6
View File
@@ -311,20 +311,23 @@ def get_materials(q: str = "", sub: str = "", detail: str = "", page: int = 1, s
@router.get("/standards")
def get_standards() -> dict:
return _call(dv.standards, STANDARD, DATA)
return _call(dv.standards, STANDARD)
def _standards_put(body: dict) -> dict:
"""고친 표준 표 = 본 프로그램 값 — git 이 따라가는 `_standard/` 파일에 바로(시스템 관리자)."""
dv.standards_check(body)
for part, name in dv.STANDARDS.items():
_write(DATA / name, body[part])
return dv.standards(STANDARD, DATA)
tmp = STANDARD / f".{name}.tmp"
text = json.dumps(body[part], ensure_ascii=False, indent=2) + "\n"
tmp.write_text(text, encoding="utf-8", newline="\n")
os.replace(tmp, STANDARD / name)
return dv.standards(STANDARD)
def _standards_reset() -> dict:
for name in dv.STANDARDS.values():
(DATA / name).unlink(missing_ok=True)
return dv.standards(STANDARD, DATA)
"""고친 값을 따로 두지 않음(바로 저장) — 되돌릴 처음 값 없음 · 지금 값 그대로."""
return dv.standards(STANDARD)
@router.put("/standards")
+3 -5
View File
@@ -550,13 +550,11 @@ def group_find(group: str, slot: dict, value: Any) -> dict:
STANDARDS = {"unit": "단위표준.json", "money": "금액단위표준.json"}
def standards(first: Any, mine: Any) -> dict:
"""{unit, money, saved} — 고친 것(`_data`)이 있으면 그것 · 없으면 처음 값(`_standard`)."""
def standards(folder: Any, _old: Any = None) -> dict: # _old = 옛 고친 값 폴더(안 씀 · 옛 부름 꼴)
"""{unit, money, saved} — 표준 표 파일(`_standard/` · 고치면 바로 그 파일) · saved 늘 False."""
out: dict[str, Any] = {"saved": False}
for part, name in STANDARDS.items():
path = mine / name if (mine / name).is_file() else first / name
out["saved"] = out["saved"] or path.parent == mine
out[part] = json.loads(path.read_text(encoding="utf-8"))
out[part] = json.loads((folder / name).read_text(encoding="utf-8"))
return out