fix(editor): too many digits after decimal point in table calculations (#9471)

This commit is contained in:
Oleg
2025-01-01 11:19:59 +01:00
committed by GitHub
parent 8227d68953
commit ade764b188

View File

@@ -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();
}, },
}), }),
]; ];