Skip to content

Commit

Permalink
fix: 그룹 전체 평균 스코어 및 내 스코어 정보 제공
Browse files Browse the repository at this point in the history
  • Loading branch information
DongGeon0908 committed Sep 27, 2024
1 parent 237855e commit 60fd8ff
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,10 @@ class GroupFacade(
score = groupUserScore.score ?: return@mapNotNull null,
)
}
val avgGroupUserScore = (ranks.sumOf { it.score } / ranks.size)
val avgGroupUserScore = when (ranks.isNotEmpty()) {
true -> (ranks.sumOf { it.score } / ranks.size)
false -> null
}
val myScore = ranks.firstOrNull { it.groupUserId == groupUser.id }?.score

return GetGroupRanksResponse(
Expand Down

0 comments on commit 60fd8ff

Please sign in to comment.