Skip to content

Commit

Permalink
fix: 난이도 오류 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
rlaisqls committed Nov 27, 2023
1 parent 5cf32b3 commit 9f8ec68
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,9 @@ class Difficulty(
var veryHardCount: Int = 0,
) {

var total = veryEasyCount + easyCount + normalCount + hardCount + veryHardCount

private fun getTotal() = veryEasyCount + easyCount + normalCount + hardCount + veryHardCount
fun getPercentage(difficultyLevel: DifficultyLevel): Int {
return getCount(difficultyLevel) * 100 / total
return getCount(difficultyLevel) * 100 / getTotal()
}

private fun getCount(difficultyLevel: DifficultyLevel): Int {
Expand All @@ -62,7 +61,7 @@ class Difficulty(
DifficultyLevel.EASY -> easyCount++
DifficultyLevel.NORMAL -> normalCount++
DifficultyLevel.HARD -> hardCount++
DifficultyLevel.VERY_HARD -> veryHardCount
DifficultyLevel.VERY_HARD -> veryHardCount++
}
}
}
Expand Down

0 comments on commit 9f8ec68

Please sign in to comment.