test #96

Merged
klaus merged 12 commits from test into main 2023-12-07 01:46:33 +00:00
2 changed files with 1 additions and 9 deletions
Showing only changes of commit 382364b5df - Show all commits

View File

@ -14,5 +14,5 @@ data class Roulette(
data class RouletteItem( data class RouletteItem(
val title: String, val title: String,
val percentage: Int val weight: Int
) )

View File

@ -43,14 +43,6 @@ class RouletteService(
if (request.items.size < 2 || request.items.size > 6) { if (request.items.size < 2 || request.items.size > 6) {
throw SodaException("룰렛 옵션은 최소 2개, 최대 6개까지 설정할 수 있습니다.") throw SodaException("룰렛 옵션은 최소 2개, 최대 6개까지 설정할 수 있습니다.")
} }
val percentage = request.items.asSequence()
.map { it.percentage }
.reduce { acc, percentage -> acc + percentage }
if (percentage != 100) {
throw SodaException("옵션 확률의 합이 100%가 아닙니다.")
}
} }
fun getRoulette(creatorId: Long): GetRouletteResponse? { fun getRoulette(creatorId: Long): GetRouletteResponse? {