diff --git a/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/model/HandHistoryViewModel.kt b/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/model/HandHistoryViewModel.kt index be63fa7a..f649de3b 100644 --- a/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/model/HandHistoryViewModel.kt +++ b/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/model/HandHistoryViewModel.kt @@ -965,6 +965,13 @@ class HandHistoryViewModel : ViewModel(), RowRepresentableDataSource, CardCentra * Defines the [player] at the saved [tappedPlayerPositionIndex] */ fun playerSelected(player: Player) { + + // Remove all use of the selected player + this.handHistory.playerSetups.filter { it.player == player }.forEach { + it.player = null + } + + // Affects the player to the selected position this.tappedPlayerPositionIndex?.let { positionIndex -> player.realm.executeTransaction { val ps = this.handHistory.playerSetupForPosition(positionIndex) ?: this.handHistory.createPlayerSetup(positionIndex)