fix(M01): 목록 검색이 양쪽 띄어쓰기를 떼고 맞댐 — 골 함 석 ↔ 함석 (PLAN 8-5)
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JgUhN55Z3BCYhUJTjwTNfj
This commit is contained in:
@@ -88,10 +88,8 @@ def chapter_of(file: str, data: dict | None = None) -> str:
|
||||
|
||||
|
||||
def _hit(row: dict, q: str) -> bool:
|
||||
q = q.lower()
|
||||
return not q or any(
|
||||
q in str(row.get(k, "")).lower() for k in ("키", "원문번호", "이름", "옛이름")
|
||||
)
|
||||
q = _squash(q) # 띄어쓰기 무시 — 「골 함 석」 ↔ 「함석」
|
||||
return not q or any(q in _squash(row.get(k, "")) for k in ("키", "원문번호", "이름", "옛이름"))
|
||||
|
||||
|
||||
def _book(data: dict) -> str | None:
|
||||
|
||||
@@ -143,3 +143,9 @@ def test_재료_줄마다_품목_칸(client) -> None:
|
||||
"lines"
|
||||
]
|
||||
assert lines[idx]["품목"]["키"] == "MT000019" and "인천" in lines[idx]["품목"]["이름"]
|
||||
|
||||
|
||||
def test_목록_검색은_띄어쓰기를_무시(client) -> None:
|
||||
for q in ("함석", "골 함 석", "골함석"):
|
||||
got = client.get("/api/m01/rows", params={"file": "재료_자재품목.json", "q": q}).json()
|
||||
assert any(r["이름"] == "골 함 석" for r in got["rows"]), q
|
||||
|
||||
Reference in New Issue
Block a user