feat(z01): 덮개에 넷째 낱말 meaning_changed — 고칠 때 그 줄의 값 아닌 글자 칸(이름·규격·단위·인도조건)을 함께 적고 갱신 뒤 달라지면 「줄의 뜻이 바뀜」(같은 코드에 다른 기준 — 노임 국가유산직종 개편 · 자재 KS 개정) · was/now 는 서버가 한 줄로 합쳐 냄(이름 칸이 여럿인 자료가 있어 화면이 합치면 판정 두 벌) · 모아 보기 차례 맨 위 · 판·공표 날짜는 뜻 칸에서 뺌(브레인)
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BW6Jdsh18WPtYUR6THZJqn
This commit is contained in:
@@ -366,6 +366,24 @@ def column_meta(kind: str, key: str) -> dict[str, Any]:
|
||||
}
|
||||
|
||||
|
||||
#: 뜻 칸에서 뺄 자리 — 판·공표 날짜는 갱신 때마다 바뀌어 「뜻 바뀜」과 구별이 안 됨
|
||||
_NOT_MEANING = ("effective_date", "date", "notice_datetime")
|
||||
|
||||
|
||||
def meaning_of(kind: str, row: dict[str, Any], editable: list[str]) -> dict[str, Any]:
|
||||
"""그 줄의 **값이 아닌 글자 칸**(이름·규격·단위·인도조건 …) — 이름표가 숨김 아니라 한 열만.
|
||||
|
||||
갱신으로 같은 코드에 다른 기준이 붙으면(노임 국가유산직종 개편 · 자재 KS 개정) 값만으로는 못 잡음.
|
||||
"""
|
||||
out = {}
|
||||
for key, value in row.items():
|
||||
if key.startswith("@") or key in editable or key in _NOT_MEANING or key.endswith("_date"):
|
||||
continue
|
||||
if isinstance(value, str) and value.strip() and not column_meta(kind, key)["hidden"]:
|
||||
out[key] = value
|
||||
return out
|
||||
|
||||
|
||||
def public(row: dict[str, Any]) -> dict[str, Any]:
|
||||
"""내보낼 줄 — 안쪽 칸(`@source`)은 뺌."""
|
||||
return {k: v for k, v in row.items() if k != "@source"}
|
||||
@@ -422,7 +440,7 @@ def edit(kind: str, row_id: str, values: dict[str, Any], by: Any) -> tuple[int,
|
||||
problem = overrides.check_value(value)
|
||||
if problem:
|
||||
return 400, {"message": f"{column}: {problem}"}
|
||||
overrides.write(kind, base, values, by)
|
||||
overrides.write(kind, base, values, by, meaning_of(kind, base, info["editable"]))
|
||||
return 200, public(next(r for r in rows(kind) if r["@id"] == row_id))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user