commit d8d3d00f278b1c1f8d4f02921f2561d9e812107c
parent 40fda631a22d2dc108454986642456ea0ee80c25
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Fri, 8 Dec 2023 15:22:43 -0500
fix double pot
Diffstat:
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/pkg/web/handlers/poker/poker.go b/pkg/web/handlers/poker/poker.go
@@ -749,7 +749,9 @@ END:
winnersStr := ""
winnerHand := ""
if len(playersGain) == 1 {
- winnerHand = playersGain[0].HandStr
+ el := playersGain[0]
+ winnerHand = el.HandStr
+ newLogEvent(g, roomLogsTopic, fmt.Sprintf("Winner #%d: %s %s -> %d", el.Group, el.Player.Username, winnerHand, el.Gain))
} else if len(playersGain) > 1 {
winnerHand = "Split pot"
for _, el := range playersGain {
@@ -803,7 +805,9 @@ func processPot(winners []GameResult, mainPot int) (res []PlayerGain) {
} else if len(winners) == 1 && len(winners[0].Players) == 1 {
// Everyone fold but 1 player
player := winners[0].Players[0]
- res = append(res, PlayerGain{player, mainPot, 0, "Only player alive"})
+ piece := mainPot
+ res = append(res, PlayerGain{player, piece, 0, "Only player alive"})
+ mainPot -= piece
} else {
isDone := true
for groupIdx, group := range winners {