feat(M01): 테스트 컨테이너 10개 로직 × 세 방식 검증 기록 · 옛 재료 줄 후보 찾기 보강 · 입력 이름 설명 대기 목록
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WRFJmmhPi4exAzHgPZHMT
This commit is contained in:
@@ -56,6 +56,22 @@ const label = (it: Brief): string => {
|
||||
return [`${it.이름 ?? ""} ${it.규격 ?? ""}`.trim(), ...prices].join(" · ");
|
||||
};
|
||||
|
||||
const oldNames = (one: LogicOne, line: HoLine): string[] => {
|
||||
const brief = one.prices[line.요소 as string] as { 이름?: string; 원문번호?: string } | null;
|
||||
const names = [brief?.이름, brief?.원문번호, (line.이름 ?? "").split(/[\s(·]/)[0]];
|
||||
return [...new Set(names.filter((n): n is string => !!n))];
|
||||
};
|
||||
|
||||
/** 이름을 차례로 찾아 후보가 나오는 첫 결과 — 다 비면 마지막 결과 */
|
||||
async function firstFound(names: string[]): Promise<Awaited<ReturnType<typeof searchPrice>>> {
|
||||
let last = await searchPrice(names[0] ?? "");
|
||||
for (const name of names.slice(1)) {
|
||||
if (last.items.length) break;
|
||||
last = await searchPrice(name);
|
||||
}
|
||||
return last;
|
||||
}
|
||||
|
||||
function pickRow(one: LogicOne, line: HoLine, i: number, swaps: Swaps, onChange: () => void) {
|
||||
const cond =
|
||||
typeof line.요소 === "object" ? (line.요소 as unknown as Record<string, unknown>) : null;
|
||||
@@ -119,7 +135,7 @@ function pickRow(one: LogicOne, line: HoLine, i: number, swaps: Swaps, onChange:
|
||||
region: "울진",
|
||||
})
|
||||
: line.종류 === "재료"
|
||||
? searchPrice(one.prices[line.요소 as string]?.이름 ?? (line.이름 ?? "").split(/[\s(·]/)[0]) // 옛 줄(고르기 조건 없음) — 품셈재료 이름 · 없으면 이름 첫 낱말
|
||||
? firstFound(oldNames(one, line)) // 옛 줄(고르기 조건 없음) — 품셈재료 이름 → 원문번호 → 이름 첫 낱말 순으로 찾아 나온 첫 것
|
||||
: searchElements(line.종류, line.이름 ?? "");
|
||||
void found
|
||||
.then((r) => {
|
||||
|
||||
Reference in New Issue
Block a user