mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-18 06:47:02 +08:00
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) {
|
||||
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({
|
||||
@@ -49,7 +51,7 @@ export const numberStatsFunctions: StatisticsConfig[] = [
|
||||
const a = arr[index];
|
||||
const b = arr[index - 1];
|
||||
if (a == null || b == null) return 'None';
|
||||
result = (a + b) / 2;
|
||||
result = parseFloat(((a + b) / 2).toFixed(2));
|
||||
}
|
||||
return result?.toString() ?? 'None';
|
||||
},
|
||||
@@ -120,7 +122,7 @@ export const numberStatsFunctions: StatisticsConfig[] = [
|
||||
if (min == null || max == null) {
|
||||
return 'None';
|
||||
}
|
||||
return (max - min).toString();
|
||||
return parseFloat((max - min).toFixed(2)).toString();
|
||||
},
|
||||
}),
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user