From a1113903eaed07479cbac2b23a824ccfe14d2693 Mon Sep 17 00:00:00 2001 From: Laurent Date: Mon, 2 Oct 2023 16:28:33 +0200 Subject: [PATCH] Fixes an issue where a lost pot was considered a winner for hero if he had chips returned --- .../android/model/realm/handhistory/HandHistory.kt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 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 c8db6f7c..d4d5c85b 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 @@ -477,7 +477,8 @@ open class HandHistory : RealmObject(), Deletable, RowRepresentable, Filterable, val heroWins: Boolean? get() { return this.heroIndex?.let { heroIndex -> - this.winnerPots.any { it.position == heroIndex } + heroIndex == this.largestWonPot?.position +// this.winnerPots.any { it.position == heroIndex } } ?: run { null } @@ -733,7 +734,7 @@ open class HandHistory : RealmObject(), Deletable, RowRepresentable, Filterable, return boardHasWildCard || playerCardHasWildCard } - val allFullCards: List + private val allFullCards: List get() { val cards = mutableListOf() cards.addAll(this.board) @@ -753,4 +754,9 @@ open class HandHistory : RealmObject(), Deletable, RowRepresentable, Filterable, return cards.filter { it.isSuitWildCard } } + val largestWonPot: WonPot? + get() { + return this.winnerPots.maxBy { it.amount } + } + } \ No newline at end of file