From 263ca3ac9a1c1a736f90089c64862cb80514da43 Mon Sep 17 00:00:00 2001
From: Klaus <klaus@vividnext.co.kr>
Date: Tue, 2 Jul 2024 19:20:00 +0900
Subject: [PATCH] =?UTF-8?q?=EB=A3=B0=EB=A0=9B=20=ED=95=A9=EA=B3=84=20?=
 =?UTF-8?q?=EA=B2=80=EC=A6=9D=20-=20Float=EB=A5=BC=20Decimal=EB=A1=9C=20?=
 =?UTF-8?q?=EB=B3=80=EA=B2=BD=ED=95=9C=20=ED=9B=84=20=EA=B2=80=EC=A6=9D?=
 =?UTF-8?q?=ED=95=98=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../vividnext/sodalive/live/roulette/v2/RouletteService.kt   | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/live/roulette/v2/RouletteService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/live/roulette/v2/RouletteService.kt
index b8c39e9..84ad0bc 100644
--- a/src/main/kotlin/kr/co/vividnext/sodalive/live/roulette/v2/RouletteService.kt
+++ b/src/main/kotlin/kr/co/vividnext/sodalive/live/roulette/v2/RouletteService.kt
@@ -23,6 +23,7 @@ import kr.co.vividnext.sodalive.member.MemberRole
 import org.springframework.data.repository.findByIdOrNull
 import org.springframework.stereotype.Service
 import org.springframework.transaction.annotation.Transactional
+import java.math.BigDecimal
 import java.util.concurrent.locks.ReentrantReadWriteLock
 import kotlin.concurrent.write
 import kotlin.random.Random
@@ -236,8 +237,8 @@ class RouletteService(
             throw SodaException("룰렛 옵션은 최소 2개, 최대 10개까지 설정할 수 있습니다.")
         }
 
-        val totalPercentage = items.map { it.percentage }.sum()
-        if (totalPercentage != 100f) {
+        val totalPercentage = items.map { BigDecimal(it.percentage.toDouble()) }.reduce(BigDecimal::plus)
+        if (totalPercentage != BigDecimal(100.0)) {
             throw SodaException("확률이 100%가 아닙니다")
         }
     }