From f456fbd3f25cf7bbff5b0555b3535a8f87c2a012 Mon Sep 17 00:00:00 2001 From: Laurent Date: Mon, 3 Feb 2020 15:41:56 +0100 Subject: [PATCH] Fixes pot calculation --- .../android/ui/modules/handhistory/HHBuilder.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/HHBuilder.kt b/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/HHBuilder.kt index 1cfa7dc9..d073e6c8 100644 --- a/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/HHBuilder.kt +++ b/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/HHBuilder.kt @@ -840,7 +840,9 @@ class HHBuilder { */ private fun addStreetHeader(rowRepresentables: MutableList, street: Street) { - val potSize = this.sortedActions.sumByDouble { it.action.effectiveAmount } + val firstIndexOfStreet = this.sortedActions.firstOrNull { it.action.street == street }?.action?.index ?: this.sortedActions.size + + val potSize = this.sortedActions.take(firstIndexOfStreet).sumByDouble { it.action.effectiveAmount } val potString = if (potSize > 0) potSize.formatted() else null val headerView = CustomizableRowRepresentable(customViewType = HandRowType.HEADER, resId = street.resId, value = potString)