Skip to content

Commit 84ca079

Browse files
committed
fix sum node-type using toFixed(2)... to be improved later
1 parent 696e00b commit 84ca079

File tree

1 file changed

+3
-3
lines changed
  • libs/web-flow-executor/src/nodes

1 file changed

+3
-3
lines changed

libs/web-flow-executor/src/nodes/sum.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export const getSum: NodeTaskFactory<NodeInfo> = (
4040
values = [input];
4141
}
4242
const sum = values
43-
.map((value) => parseInt(value) ?? 0)
43+
.map((value) => parseFloat(value) ?? 0)
4444
.reduce((a, b) => a + b, 0);
4545
if (htmlNode) {
4646
createElement(
@@ -56,15 +56,15 @@ export const getSum: NodeTaskFactory<NodeInfo> = (
5656
if (hasInitialValue) {
5757
hasInitialValue = false;
5858
}
59-
htmlNode.domElement.textContent = `Sum: ${sum.toString()}`;
59+
htmlNode.domElement.textContent = `Sum: ${sum.toFixed(2)}`;
6060

6161
if (rect) {
6262
rect.resize(240);
6363
}
6464
}
6565
currentSum = sum;
6666
return {
67-
result: sum.toString(),
67+
result: sum.toFixed(2),
6868
followPath: undefined,
6969
previousOutput: (previousOutput ?? '').toString(),
7070
};

0 commit comments

Comments
 (0)