dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit 90961abc5ad6885e149e1689c3f1847f0453fad2
parent a27ac2cfb2d0ca1ceba1fb5a24cb04cbb6d9302b
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Wed, 27 Dec 2023 12:20:20 -0500

keep precision

Diffstat:
Mpkg/web/handlers/poker/poker.go | 7+++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/pkg/web/handlers/poker/poker.go b/pkg/web/handlers/poker/poker.go @@ -228,7 +228,7 @@ type PokerPlayer struct { unsit atomic.Bool gameBet database.PokerChip allInMaxGain database.PokerChip - rakePaid database.PokerChip + rakePaid float64 countChancesToAction int } @@ -1390,8 +1390,7 @@ func computeRake(players []*PokerPlayer, pokerTableMinBet, mainPotIn database.Po rake = calculateRake(mainPotIn, pokerTableMinBet, len(players)) for _, p := range players { pctOfPot := float64(p.gameBet) / float64(mainPotIn) - pctOfRake := pctOfPot * float64(rake) - p.rakePaid = database.PokerChip(math.RoundToEven(pctOfRake)) + p.rakePaid = pctOfPot * float64(rake) } mainPotOut = mainPotIn - rake return mainPotOut, rake @@ -1453,7 +1452,7 @@ func applyRake(g *Game, tx *database.DkfDB, rake database.PokerChip) { rakeBackMap := make(map[database.UserID]database.PokerChip) for _, p := range g.ongoing.players { if p.pokerReferredBy != nil { - rakeBack := database.PokerChip(math.RoundToEven(RakeBackPct * float64(p.rakePaid))) + rakeBack := database.PokerChip(math.RoundToEven(RakeBackPct * p.rakePaid)) rakeBackMap[*p.pokerReferredBy] += rakeBack } }