feat: cover the scenario when team has less than 5 players

This commit is contained in:
Leonardo Murça 2025-07-19 14:53:19 -03:00
parent ef52e39c0d
commit c10a667b8d

View file

@ -48,7 +48,8 @@ class MatchDetailsViewModel @Inject constructor(
private fun teamOrWithDefaultPlayers(team: Team?): Team? { private fun teamOrWithDefaultPlayers(team: Team?): Team? {
return team?.let { return team?.let {
if (it.players.isEmpty()) it.copy(players = List(5) { playerPlaceholder() }) else it val filledPlayers = it.players + List((5 - it.players.size).coerceAtLeast(0)) { playerPlaceholder() }
it.copy(players = filledPlayers)
} }
} }