dkforest

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

commit 59258e16897f9d4fbc507d0203a83b564145b4e4
parent 85891383d808bd656806d59d2f9268156efdfc16
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Sun, 17 Dec 2023 02:26:46 -0500

cleanup

Diffstat:
Mpkg/database/tablePokerTables.go | 2+-
Mpkg/web/handlers/poker/poker.go | 13++++++-------
2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/pkg/database/tablePokerTables.go b/pkg/database/tablePokerTables.go @@ -115,7 +115,7 @@ func (d *DkfDB) PokerTableAccountRefundPartialBet(userID UserID, pokerTableID in } func (d *DkfDB) PokerTableAccountGain(userID UserID, pokerTableID int64, gain PokerChip) (err error) { - err = d.db.Exec(`UPDATE poker_table_accounts SET amount = amount + ?, amount_bet = 0 WHERE user_id = ? AND poker_table_id = ?`, + err = d.db.Exec(`UPDATE poker_table_accounts SET amount = amount + ? WHERE user_id = ? AND poker_table_id = ?`, gain, userID, pokerTableID).Error return } diff --git a/pkg/web/handlers/poker/poker.go b/pkg/web/handlers/poker/poker.go @@ -139,10 +139,15 @@ func (p *PokerPlayer) refundPartialBet(db *database.DkfDB, pokerTableID int64, d p.Cash += diff } +func (p *PokerPlayer) doBet(db *database.DkfDB, pokerTableID int64, bet database.PokerChip) { + _ = db.PokerTableAccountBet(p.UserID, pokerTableID, bet) + p.Bet += bet + p.Cash -= bet +} + func (p *PokerPlayer) gain(db *database.DkfDB, pokerTableID int64, gain database.PokerChip) { _ = db.PokerTableAccountGain(p.UserID, pokerTableID, gain) p.Cash += gain - p.Bet = 0 } func (p *PokerPlayer) resetBet(db *database.DkfDB, pokerTableID int64) { @@ -156,12 +161,6 @@ func (p *PokerPlayer) refundBet(db *database.DkfDB, pokerTableID int64) { p.Bet = 0 } -func (p *PokerPlayer) doBet(db *database.DkfDB, pokerTableID int64, bet database.PokerChip) { - _ = db.PokerTableAccountBet(p.UserID, pokerTableID, bet) - p.Bet += bet - p.Cash -= bet -} - func (p *PokerPlayer) doBetAndNotif(db *database.DkfDB, pokerTableID int64, bet database.PokerChip, roomTopic string) { p.doBet(db, pokerTableID, bet) p.RoundTotalBet += bet