Only add contested pots when considering winning pots

kmmtest
Laurent 2 years ago
parent 829e64448f
commit d07793c409
  1. 29
      app/src/main/java/net/pokeranalytics/android/model/realm/handhistory/HandHistory.kt

@ -642,19 +642,22 @@ open class HandHistory : RealmObject(), Deletable, RowRepresentable, Filterable,
pots.forEach { pot -> pots.forEach { pot ->
val winningPositions = compareHands(pot.positions.toList()) if (pot.positions.size > 1) { // we only consider contested pots
// Distributes the pot for each winners val winningPositions = compareHands(pot.positions.toList())
val share = pot.amount / winningPositions.size
winningPositions.forEach { p -> // Distributes the pot for each winners
val wp = wonPots[p] val share = pot.amount / winningPositions.size
if (wp == null) { winningPositions.forEach { p ->
val wonPot = WonPot() val wp = wonPots[p]
wonPot.position = p if (wp == null) {
wonPot.amount = share val wonPot = WonPot()
wonPots[p] = wonPot wonPot.position = p
} else { wonPot.amount = share
wp.amount += share wonPots[p] = wonPot
} else {
wp.amount += share
}
} }
} }

Loading…
Cancel
Save