Skip to content

Commit

Permalink
Fixed a crash for users with no games
Browse files Browse the repository at this point in the history
  • Loading branch information
acristescu committed Sep 9, 2023
1 parent f4d7a48 commit 42a0b05
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,9 @@ private val COLORS_DARK = listOf(
}
}

@Preview @Composable private fun PreviewGainLossBar() {
@Preview
@Composable
private fun PreviewGainLossBar() {
OnlineGoTheme {
Surface(
shape = MaterialTheme.shapes.medium,
Expand All @@ -574,7 +576,9 @@ private val COLORS_DARK = listOf(
}
}

@Composable @Preview private fun Preview() {
@Composable
@Preview
private fun Preview() {
OnlineGoTheme {
StatsScreen(StatsState.Initial.copy(
chartData = listOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,8 @@ class GetUserStatsUseCase (
totalRatio = if (total == 0) 0f else matching.toFloat() / total,
won = winning,
lost = matching - winning,
winRate = winning.toFloat() / matching,
lossRate = 1f - (winning.toFloat() / matching)
winRate = if(matching == 0) 0f else winning.toFloat() / matching,
lossRate = if(matching == 0) 0f else 1f - (winning.toFloat() / matching)
)
}

Expand Down

0 comments on commit 42a0b05

Please sign in to comment.