Skip to content

Commit

Permalink
🐛 fix rounding
Browse files Browse the repository at this point in the history
  • Loading branch information
stepandel committed Sep 26, 2024
1 parent 434d3fd commit ddf571c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/app/api/common/ballots/ballotDistributionStrategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ async function applyDistributionStrategyForAddress({
address,
},
},
data: { allocation: p.allocation },
data: { allocation: p.allocation?.toFixed(2) },
})
)
);
Expand Down
6 changes: 4 additions & 2 deletions src/app/api/common/ballots/updateBallotProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,14 +394,16 @@ async function updateAllProjectsInBallotForAddress({
},
},
update: {
allocation: Math.round(Number(project.allocation) * 100) / 100,
allocation: Number(project.allocation)?.toFixed(2),
updated_at: new Date(),
},
create: {
project_id: project.project_id,
round: roundId,
address,
allocation: project.impact ? project.allocation : null,
allocation: project.impact
? Number(project.allocation)?.toFixed(2)
: null,
impact: project.impact,
rank: Math.floor((500_000 / projects.length) * (i + 1)),
},
Expand Down

0 comments on commit ddf571c

Please sign in to comment.