dkforest

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

commit 4d35e82b3b1433aced4cca880ed7c447e5a86fa7
parent c3a71b8f6bee30da28e74a6ef716e09b5ecc096e
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Tue, 12 Dec 2023 17:41:50 -0500

cleanup

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

diff --git a/pkg/web/handlers/poker/poker.go b/pkg/web/handlers/poker/poker.go @@ -1254,21 +1254,23 @@ func PokerSitHandler(c echo.Context) error { if c.Request().Method == http.MethodPost { pokerTable, err := db.GetPokerTableBySlug(roomID) + tableMinBuyIn := pokerTable.MinBuyIn + tableID := pokerTable.ID if err != nil { return c.HTML(http.StatusOK, html) } - tableAccount, err := db.GetPokerTableAccount(authUser.ID, pokerTable.ID) + tableAccount, err := db.GetPokerTableAccount(authUser.ID, tableID) if err != nil { logrus.Error(err) return c.HTML(http.StatusOK, html) } userChips := int64(authUser.GetChips(tableAccount.PokerTable.IsTest)) totalChips := userChips + tableAccount.Amount - if totalChips < pokerTable.MinBuyIn { - PokerPubSub.Pub(roomUserTopic, ErrorMsgEvent{Message: fmt.Sprintf("Not enough chips to sit; have: %d; needs: %d", totalChips, pokerTable.MinBuyIn)}) + if totalChips < tableMinBuyIn { + PokerPubSub.Pub(roomUserTopic, ErrorMsgEvent{Message: fmt.Sprintf("Not enough chips to sit; have: %d; needs: %d", totalChips, tableMinBuyIn)}) return c.HTML(http.StatusOK, html) } - needed := pokerTable.MinBuyIn - tableAccount.Amount + needed := tableMinBuyIn - tableAccount.Amount authUser.IncrChips(int(-needed), tableAccount.PokerTable.IsTest) tableAccount.Amount += needed if err := g.SitPlayer(authUser, pos, tableAccount.Amount); err != nil {