Merge remote-tracking branch 'origin/sub_desktop_1' into main_laptop_1 — 총칙 기본 감춤 기준을 잣대 list_default 로(데스크탑 서브) 받음 · 줄 구실 표시 칸 이름도 잣대 list_label 을 따르게 시험 맞춤
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BW6Jdsh18WPtYUR6THZJqn
This commit is contained in:
@@ -186,8 +186,10 @@ def notice(kind: str) -> list[str]:
|
||||
#: 줄 구실만 기본 「공종」(총칙 기본 감춤 · 서브 2ee6a7ed · 브레인).
|
||||
FILTER_KEYS = ("link", "division", "axis_role")
|
||||
ALL = ""
|
||||
#: 값을 안 보냈을 때 거는 값 — 총칙 줄은 기본 감춤 · 「전부」를 고르면 보임(2026-09-17 브레인)
|
||||
DEFAULTS = {"axis_role": "work_item"}
|
||||
#: 값을 안 보냈을 때 거는 값 — **잣대가 정한다**(`axis_policy.json` 의 `list_default`).
|
||||
#: ⚠ 코드에 박지 않는다 — 총칙 범위는 기관이 정하는 것이라 관리자가 고칠 수 있어야 한다.
|
||||
#: 잣대를 못 읽을 때만 쓰는 대비값(총칙 줄은 기본 감춤 · 「전부」를 고르면 보임 · 2026-09-17 브레인).
|
||||
FALLBACK_DEFAULTS = {"axis_role": "work_item"}
|
||||
|
||||
|
||||
def _facets(kind: str) -> dict[str, dict[str, str]]:
|
||||
@@ -204,17 +206,30 @@ def _facets(kind: str) -> dict[str, dict[str, str]]:
|
||||
}
|
||||
|
||||
|
||||
def _role_names() -> dict[str, str]:
|
||||
"""줄 구실 이름 — `axis_policy.json`(데스크탑 서브 잣대) 한 곳에서."""
|
||||
def _policy() -> dict[str, Any]:
|
||||
"""줄 구실 잣대 — `axis_policy.json`(데스크탑 서브) 한 곳에서."""
|
||||
path = FOLDER / "axis_policy.json"
|
||||
if not path.is_file():
|
||||
return {}
|
||||
roles = _read(str(path), path.stat().st_mtime_ns).get("roles") or {}
|
||||
return {key: str(role.get("name_ko") or key) for key, role in roles.items()}
|
||||
return _read(str(path), path.stat().st_mtime_ns) if path.is_file() else {}
|
||||
|
||||
|
||||
def _role_names() -> dict[str, str]:
|
||||
"""거르기 상자에 뜰 이름. 목록에서는 「총칙」이 아니라 **공종이 아님**을 드러내는 이름으로 적는다."""
|
||||
roles = _policy().get("roles") or {}
|
||||
return {
|
||||
key: str(role.get("list_label") or role.get("name_ko") or key)
|
||||
for key, role in roles.items()
|
||||
}
|
||||
|
||||
|
||||
def _defaults() -> dict[str, str]:
|
||||
"""안 고른 가름에 걸 값 — 잣대의 `list_default`. 못 읽으면 대비값."""
|
||||
wanted = _policy().get("list_default") or {}
|
||||
key = str(wanted.get("filter") or "")
|
||||
return {key: str(wanted.get("value") or ALL)} if key else dict(FALLBACK_DEFAULTS)
|
||||
|
||||
|
||||
def filters(kind: str, rows: list[dict[str, Any]]) -> list[dict[str, Any]]:
|
||||
"""거르기 상자 — 줄이 둘 이상으로 갈리는 가름만 · 기본은 `DEFAULTS`(그 값이 표에 있을 때) 아니면 「전부」."""
|
||||
"""거르기 상자 — 값이 둘 이상 갈리는 가름만 · 기본은 **잣대**(`list_default`)가 정한다 — 그 값이 표에 있을 때만."""
|
||||
facets = _facets(kind)
|
||||
labels = {
|
||||
"link": ("연결", {LINKED: "연결된 것만"}),
|
||||
@@ -231,7 +246,7 @@ def filters(kind: str, rows: list[dict[str, Any]]) -> list[dict[str, Any]]:
|
||||
if len(counts) < 2: # 다 같은 값이면 거를 것이 없음(연결은 「연결됨」 · 빈칸 둘로 갈림)
|
||||
continue
|
||||
label, names = labels[key]
|
||||
default = DEFAULTS.get(key, ALL)
|
||||
default = _defaults().get(key, ALL)
|
||||
out.append(
|
||||
{
|
||||
"key": key,
|
||||
|
||||
Reference in New Issue
Block a user