Fixes pot calculation

hh
Laurent 6 years ago
parent a93e2da0e8
commit f456fbd3f2
  1. 4
      app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/HHBuilder.kt

@ -840,7 +840,9 @@ class HHBuilder {
*/
private fun addStreetHeader(rowRepresentables: MutableList<RowRepresentable>, 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)

Loading…
Cancel
Save