Skip to content

Commit

Permalink
fix(database): sum shows too many digits after decimal point (#8833)
Browse files Browse the repository at this point in the history
Co-authored-by: 3720 <zuozijian1994@gmail.com>
  • Loading branch information
OlegDev1 and zzj3720 authored Dec 5, 2024
1 parent 2fa9d81 commit a98c474
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/CLA.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,4 @@ Example:
- Samuel Golmann, @goldsam, 2024/07/29
- satoren, @satoren, 2024/08/09
- Nikita Minaev, @majula2111, 2024/09/26
- Oleg, @OlegDev1, 2024/12/03
4 changes: 3 additions & 1 deletion packages/affine/data-view/src/core/statistics/number.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ export const numberStatsFunctions: StatisticsConfig[] = [
if (numbers.length === 0) {
return 'None';
}
return numbers.reduce((a, b) => a + b, 0).toString();
return parseFloat(
numbers.reduce((a, b) => a + b, 0).toFixed(2)
).toString();
},
}),
createStatisticConfig({
Expand Down

0 comments on commit a98c474

Please sign in to comment.