Merge remote-tracking branch 'origin/sub_laptop_6' into main_laptop_1

This commit is contained in:
2026-10-04 21:46:44 +09:00
2 changed files with 9 additions and 2 deletions
+2 -2
View File
@@ -470,7 +470,7 @@ def _lowest(row: dict) -> object:
def pick(kind: str, q: str, limit: int) -> dict:
"""고르기 창 — `price` 자재품목(관급 줄 포함 · ref = 키) · `job` 값 있는 공표 노임 직종
(미확보·추정 빼고 모든 구분)(ref = 키) · 이름·규격 낱말이 모두 들어간 줄."""
(미확보·추정 빼고 모든 구분)(ref = 키) · 낱말마다 이름·규격에 들어 있거나 키와 같은 줄."""
if kind not in _PICK:
raise StoreError(404, f"없는 고르기 「{kind}」")
words = [_squash(w) for w in q.split()]
@@ -481,7 +481,7 @@ def pick(kind: str, q: str, limit: int) -> dict:
):
continue
text = _squash(f"{row.get('이름')} {row.get('규격')} {' '.join(row.get('옛이름') or [])}")
if all(w in text for w in words):
if all(w in text or w == _squash(row.get("키")) for w in words):
hits.append(
{
"ref": str(row.get("키")),
+7
View File
@@ -341,6 +341,13 @@ def test_고르기_자재품목_직종(client: TestClient) -> None:
market = _get(client, "/api/m01/pick", kind="price", q="H형강 관급", limit=50)
# 조달청 값이 아직 안 이어진 줄도 섞여 있음 — 이어진 줄이 하나라도 있으면 됨
assert any(i["관급"] and i["값"] > 0 for i in market["items"])
# 키로도 찾음(찾기 칸 글 「이름 · 규격 · 코드」) · 이름 낱말 AND 는 그대로
cement = _get(client, "/api/m01/pick", kind="price", q="시멘트 전국")["items"]
code = cement[0]["ref"]
by_code = _get(client, "/api/m01/pick", kind="price", q=code.lower())["items"]
assert [i["ref"] for i in by_code] == [code]
assert _get(client, "/api/m01/pick", kind="price", q=f"시멘트 {code}")["total"] == 1
assert _get(client, "/api/m01/pick", kind="price", q=f"없는낱말 {code}")["total"] == 0
job = _get(client, "/api/m01/pick", kind="job", q="보통인부")
assert job["items"][0]["값"] > 0 and job["items"][0]["ref"] == key_of("LB:1002")
assert _get(client, "/api/m01/pick", kind="job", q="CAD설계사")["items"][0]["ref"] == key_of(