fix: fix the goal node's "can_fail" to have the correct property.

This commit is contained in:
Björn Otgaar
2026-01-06 14:47:56 +01:00
parent 216b136a75
commit 508fa48be6
2 changed files with 7 additions and 6 deletions

View File

@@ -9,5 +9,5 @@ export const GoalNodeDefaults: GoalNodeData = {
description: "",
achieved: false,
hasReduce: true,
can_fail: true,
can_fail: false,
};

View File

@@ -17,6 +17,8 @@ import PlanEditorDialog from '../components/PlanEditor';
* @param droppable: whether this node is droppable from the drop bar (initialized as true)
* @param desciption: description of the goal
* @param hasReduce: whether this node has reducing functionality (true by default)
* @param can_fail: whether this plan should be checked- this plan could possible fail
* @param plan: The (possible) attached plan to this goal
*/
export type GoalNodeData = {
label: string;
@@ -69,13 +71,13 @@ export default function GoalNode({id, data}: NodeProps<GoalNode>) {
</div>
{data.plan && (<div className={"flex-row gap-md align-center " + (planIterate ? "" : styles.planNoIterate)}>
{planIterate ? "" : <s></s>}
<label htmlFor={checkbox_id}>Try this plan only once (allow critical abortion):</label>
<label htmlFor={checkbox_id}>{!planIterate ? "This plan always succeeds!" : ("We " + (data.can_fail ? "will " : "wont ") + "check if this plan fails")}:</label>
<input
id={checkbox_id}
type={"checkbox"}
disabled={!planIterate}
checked={!planIterate || data.can_fail}
onChange={(e) => planIterate ? setFailable(e.target.checked) : undefined}
onChange={(e) => planIterate ? setFailable(e.target.checked) : setFailable(false)}
/>
</div>
)}
@@ -107,9 +109,8 @@ export function GoalReduce(node: Node, _nodes: Node[]) {
const data = node.data as GoalNodeData;
return {
id: node.id,
name: data.label,
description: data.description,
can_fail: data.can_fail,
name: data.description,
can_fail: data.can_fail,
plan: data.plan ? PlanReduce(data.plan) : "",
}
}