commit e41bd45bfcd71a7a50272681407e286cda8fe01c
parent 777619e70f15336533b4dbe38f2e500d7a465e6d
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Thu, 7 Dec 2023 16:50:18 -0500
sort winners players
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/pkg/web/handlers/poker/poker.go b/pkg/web/handlers/poker/poker.go
@@ -169,6 +169,12 @@ func (g *Ongoing) computeWinners() (winner []GameResult) {
arr := make([]GameResult, 0)
for k, v := range m {
+ sort.Slice(v, func(i, j int) bool {
+ if v[i].Cash == v[j].Cash {
+ return v[i].RoundTotalBet < v[j].RoundTotalBet
+ }
+ return v[i].Cash < v[j].Cash
+ })
arr = append(arr, GameResult{HandScore: k, Players: v})
}
sort.Slice(arr, func(i, j int) bool { return arr[i].HandScore < arr[j].HandScore })