File tree Expand file tree Collapse file tree 3 files changed +8
-4
lines changed
core/domain/src/main/java/com/withpeace/withpeace/core/domain/model/balancegame
feature/balancegame/src/main/java/com/withpeace/withpeace/feature/balancegame Expand file tree Collapse file tree 3 files changed +8
-4
lines changed Original file line number Diff line number Diff 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 {
Original file line number Diff line number Diff line change 11package com.withpeace.withpeace.core.domain.model.balancegame
22
33import com.withpeace.withpeace.core.domain.model.date.Date
4+ import kotlin.math.roundToInt
45
56data 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 {
Original file line number Diff line number Diff line change 11package com.withpeace.withpeace.feature.balancegame
22
3+ import android.util.Log
34import com.withpeace.withpeace.core.domain.model.balancegame.BalanceGame
45import com.withpeace.withpeace.core.domain.model.balancegame.BalanceGameComment
56import com.withpeace.withpeace.core.ui.DateUiModel
You can’t perform that action at this time.
0 commit comments