From 11fb5e595f5f56ef584ec03b461367f4a2d2049b Mon Sep 17 00:00:00 2001 From: Laurent Date: Thu, 20 Mar 2025 12:15:54 +0100 Subject: [PATCH] Fix bad accounting --- .../ui/modules/handhistory/model/ActionList.kt | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/model/ActionList.kt b/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/model/ActionList.kt index 616b595b..6288fd72 100644 --- a/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/model/ActionList.kt +++ b/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/model/ActionList.kt @@ -117,7 +117,8 @@ class ActionList(var listener: ActionListListener? = null) : ArrayList { getStreetLastSignificantAction(computedAction.street, index - 1)?.let { val betAmount = it.action.amount ?: 0.0 + + val committedStack = getPreviouslyCommittedAmount(index) ?: 0.0 val remainingStack = computedAction.stackBeforeActing - if (remainingStack != null && remainingStack < betAmount) { + if (remainingStack != null && committedStack + remainingStack < betAmount) { type = Action.Type.CALL_ALLIN } } ?: throw PAIllegalStateException("Can't call without a significant action") @@ -219,7 +222,8 @@ class ActionList(var listener: ActionListListener? = null) : ArrayList { - if (remainingStack != null && actionAmount != null && remainingStack <= actionAmount) { + val committedStack = getPreviouslyCommittedAmount(index) ?: 0.0 + if (remainingStack != null && actionAmount != null && committedStack + remainingStack <= actionAmount) { setOf(Action.Type.FOLD, Action.Type.CALL) } else { setOf(Action.Type.FOLD, Action.Type.CALL, Action.Type.POT, Action.Type.RAISE, Action.Type.UNDEFINED_ALLIN) @@ -524,7 +528,8 @@ class ActionList(var listener: ActionListListener? = null) : ArrayList { val streetNextSignificantIndex = getStreetNextSignificantAction(index)?.action?.index - ?: this.lastIndexOfStreet(index) + 1 // +1 because of "until" + ?: (this.lastIndexOfStreet(index) + 1) // +1 because of "until" return this.filter { it.action.index in ((index + 1) until streetNextSignificantIndex) && (it.action.type?.isCall ?: false) @@ -610,7 +615,7 @@ class ActionList(var listener: ActionListListener? = null) : ArrayList