Skip to content

Commit c59ac57

Browse files
committed
hotfix: 퍼센트 계산 수식 변경 및 출시
1 parent 8c8a8bd commit c59ac57

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

app/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ android {
1010
defaultConfig {
1111
applicationId = "com.withpeace.withpeace"
1212
targetSdk = 34
13-
versionCode = 16
14-
versionName = "2.3.1"
13+
versionCode = 17
14+
versionName = "2.3.2"
1515

1616
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
1717
vectorDrawables {

core/domain/src/main/java/com/withpeace/withpeace/core/domain/model/balancegame/BalanceGame.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.withpeace.withpeace.core.domain.model.balancegame
22

33
import com.withpeace.withpeace.core.domain.model.date.Date
4+
import kotlin.math.roundToInt
45

56
data class BalanceGame(
67
val id: Long,
@@ -17,10 +18,12 @@ data class BalanceGame(
1718
val comments: List<BalanceGameComment>,
1819
) {
1920
fun getAPercentage(): Int {
20-
if(optionACount + optionBCount == 0L) {
21+
val totalSum = optionACount.toDouble() + optionBCount.toDouble()
22+
23+
if (totalSum == 0.0) {
2124
return 0
2225
}
23-
return ((optionACount / (optionACount + optionBCount)) * 100).toInt()
26+
return ((optionACount.toDouble() / totalSum) * 100).roundToInt()
2427
}
2528

2629
fun getBPercentage(): Int {

feature/balancegame/src/main/java/com/withpeace/withpeace/feature/balancegame/BalanceGameUiModel.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.withpeace.withpeace.feature.balancegame
22

3+
import android.util.Log
34
import com.withpeace.withpeace.core.domain.model.balancegame.BalanceGame
45
import com.withpeace.withpeace.core.domain.model.balancegame.BalanceGameComment
56
import com.withpeace.withpeace.core.ui.DateUiModel

0 commit comments

Comments
 (0)