fix(editor): too many digits after decimal point in table calculations (#9471)
This commit is contained in:
@@ -30,7 +30,9 @@ export const numberStatsFunctions: StatisticsConfig[] = [
|
|||||||
if (numbers.length === 0) {
|
if (numbers.length === 0) {
|
||||||
return 'None';
|
return 'None';
|
||||||
}
|
}
|
||||||
return (numbers.reduce((a, b) => a + b, 0) / numbers.length).toString();
|
return parseFloat(
|
||||||
|
(numbers.reduce((a, b) => a + b, 0) / numbers.length).toFixed(2)
|
||||||
|
).toString();
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
createStatisticConfig({
|
createStatisticConfig({
|
||||||
@@ -49,7 +51,7 @@ export const numberStatsFunctions: StatisticsConfig[] = [
|
|||||||
const a = arr[index];
|
const a = arr[index];
|
||||||
const b = arr[index - 1];
|
const b = arr[index - 1];
|
||||||
if (a == null || b == null) return 'None';
|
if (a == null || b == null) return 'None';
|
||||||
result = (a + b) / 2;
|
result = parseFloat(((a + b) / 2).toFixed(2));
|
||||||
}
|
}
|
||||||
return result?.toString() ?? 'None';
|
return result?.toString() ?? 'None';
|
||||||
},
|
},
|
||||||
@@ -120,7 +122,7 @@ export const numberStatsFunctions: StatisticsConfig[] = [
|
|||||||
if (min == null || max == null) {
|
if (min == null || max == null) {
|
||||||
return 'None';
|
return 'None';
|
||||||
}
|
}
|
||||||
return (max - min).toString();
|
return parseFloat((max - min).toFixed(2)).toString();
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user