From 58bf0576f4bf8a965b4a2d4b454c0fe9467a10ce Mon Sep 17 00:00:00 2001 From: gahyuun Date: Mon, 23 Dec 2024 09:03:37 +0900 Subject: [PATCH] fix: modify calcuate percentage --- app/utils/calculate.util.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/app/utils/calculate.util.ts b/app/utils/calculate.util.ts index 4f5658d..a2cfb1d 100644 --- a/app/utils/calculate.util.ts +++ b/app/utils/calculate.util.ts @@ -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;