Skip to content

Commit 7aad777

Browse files
committed
Fix weird floating point calculation error
1 parent 22f19ca commit 7aad777

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/components/PointsBalloon/PartProgress.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const CustomLabel = ({ x, y, stroke, value }) => {
3232

3333
const PartProgress = ({ name, data, appliesForStudyRight }) => {
3434
const allChartData = Object.entries(data).map(([tool, data]) => {
35-
return { tool, progress: data.progress * 100 }
35+
return { tool, progress: Math.floor(data.progress * 100 + 0.000000001) }
3636
})
3737
let nPointsSum = 0
3838
let maxPointsSum = 0
@@ -44,7 +44,7 @@ const PartProgress = ({ name, data, appliesForStudyRight }) => {
4444
let totalProgress = Math.floor((nPointsSum / maxPointsSum) * 100) / 100
4545
allChartData.push({
4646
tool: "Tehtäväpisteet yhteensä",
47-
progress: totalProgress * 100,
47+
progress: Math.floor(totalProgress * 100 + 0.000000001),
4848
})
4949
return (
5050
<PartProgressContainer>

0 commit comments

Comments
 (0)