fix(m02-df): 다른 로직 입력을 빼면 받는 알약으로 들어오던 선도 지움
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019ACSGaHdLgnkEkoA4LDtMU
This commit is contained in:
@@ -259,7 +259,7 @@ export function logicRefOf(key: string, other: CfLogic): CfLogicRef {
|
||||
};
|
||||
}
|
||||
|
||||
/** 다른 로직 입력 넣기 · 빼기(null) — 빼면 변수 상태로 돌아가고 그 알약에서 나간 선도 지움 */
|
||||
/** 다른 로직 입력 넣기 · 빼기(null) — 빼면 변수 상태로 돌아가고 이 상자의 알약에 닿은 선은 모두 지움 */
|
||||
export function setLogicInput(lg: CfLogic, id: string, ref: CfLogicRef | null): CfLogic {
|
||||
return {
|
||||
...lg,
|
||||
@@ -270,7 +270,7 @@ export function setLogicInput(lg: CfLogic, id: string, ref: CfLogicRef | null):
|
||||
: { mode: "variable", elements: [], variables: [] };
|
||||
return { ...b, input, unit: unitOfInput(input) };
|
||||
}),
|
||||
links: lg.links.filter((l) => l.from.box !== id),
|
||||
links: lg.links.filter((l) => l.from.box !== id && l.to.box !== id), // 나가던 선 · 그 로직의 받는 알약으로 들어오던 선 모두
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -230,10 +230,13 @@ def test_다른_로직_상자는_출력_단위를_따르고_빼면_변수로_돌
|
||||
assert box["unit"] == "㎥/시간"
|
||||
assert call("pillNames", box) == ["작업량"]
|
||||
lg["links"] = [
|
||||
{"id": "l1", "from": {"box": "b1", "name": "작업량"}, "to": {"box": "b2", "name": "x"}}
|
||||
{"id": "l1", "from": {"box": "b1", "name": "작업량"}, "to": {"box": "b2", "name": "x"}},
|
||||
{"id": "l2", "from": {"box": "b2", "name": "관경"}, "to": {"box": "b1", "name": "q"}},
|
||||
{"id": "l3", "from": {"box": "b2", "name": "관경"}, "to": {"box": "b3", "name": "y"}},
|
||||
]
|
||||
back = call("setLogicInput", lg, "b1", None)
|
||||
assert back["boxes"][0]["input"]["mode"] == "variable" and back["links"] == []
|
||||
assert back["boxes"][0]["input"]["mode"] == "variable"
|
||||
assert [x["id"] for x in back["links"]] == ["l3"]
|
||||
assert call("reconcileUnit", lg, "b1") == lg # 다른 로직 상자 단위는 안 건드림
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user