From ada7ec05b8bc80eece671a84f74d402e01d343aa Mon Sep 17 00:00:00 2001 From: Laurent Date: Wed, 27 May 2020 11:08:55 +0200 Subject: [PATCH] Fixes straddle regression + define default number of players to 9 --- .../model/realm/handhistory/HandHistory.kt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/net/pokeranalytics/android/model/realm/handhistory/HandHistory.kt b/app/src/main/java/net/pokeranalytics/android/model/realm/handhistory/HandHistory.kt index ea338803..73d93282 100644 --- a/app/src/main/java/net/pokeranalytics/android/model/realm/handhistory/HandHistory.kt +++ b/app/src/main/java/net/pokeranalytics/android/model/realm/handhistory/HandHistory.kt @@ -95,7 +95,7 @@ open class HandHistory : RealmObject(), Deletable, RowRepresentable, Filterable, /*** * Number of players in the hand */ - var numberOfPlayers: Int = 4 + var numberOfPlayers: Int = 9 /*** * Number of players in the hand @@ -169,27 +169,27 @@ open class HandHistory : RealmObject(), Deletable, RowRepresentable, Filterable, this.session = handSetup.session this.date = this.session?.handHistoryAutomaticDate ?: Date() - this.createActions() + this.createActions(handSetup) } /*** * Creates the initial actions of the hand history */ - private fun createActions() { + private fun createActions(handSetup: HandSetup) { this.actions.clear() this.addAction(0, Action.Type.POST_SB, this.smallBlind) this.addAction(1, Action.Type.POST_BB, this.bigBlind) -// val positions = Position.positionsPerPlayers(this.numberOfPlayers) - // var lastStraddler: Int? = null -// straddlePositions.forEach { position -> // position are sorted here -// val positionIndex = positions.indexOf(position) -// this.addAction(positionIndex, Action.Type.STRADDLE) + + val positions = Position.positionsPerPlayers(this.numberOfPlayers) + handSetup.straddlePositions.forEach { position -> // position are sorted here + val positionIndex = positions.indexOf(position) + this.addAction(positionIndex, Action.Type.STRADDLE) // lastStraddler = positionIndex -// } + } // val totalActions = this.actions.size // val startingPosition = lastStraddler?.let { it + 1 } ?: totalActions