Skip to content

Commit

Permalink
fix: modify calcuate percentage
Browse files Browse the repository at this point in the history
  • Loading branch information
gahyuun committed Dec 23, 2024
1 parent 1ce4caf commit 58bf057
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions app/utils/calculate.util.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export const getPercentage = (numerator: number, denominator: number) => {
if (numerator >= denominator) return 100;
const percentage = Number(((numerator / denominator) * 100).toFixed(0));
if (denominator === 0) return 0;
return percentage > 100 ? 100 : percentage;
Expand Down

0 comments on commit 58bf057

Please sign in to comment.