commit b61e37a138055ebe38bb8b639080df23020b0f27
parent f7f3bfccb4a2bc614a87868c9edd0b67318d1385
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Sat, 16 Dec 2023 02:21:10 -0500
hands played
Diffstat:
3 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/cmd/dkf/migrations/154.sql b/cmd/dkf/migrations/154.sql
@@ -0,0 +1,4 @@
+-- +migrate Up
+ALTER TABLE poker_casino ADD COLUMN hands_played INTEGER NOT NULL DEFAULT 0;
+
+-- +migrate Down
diff --git a/pkg/database/tablePokerCasino.go b/pkg/database/tablePokerCasino.go
@@ -4,8 +4,9 @@ import "fmt"
// PokerCasino table, should always be one row
type PokerCasino struct {
- ID int64
- Rake PokerChip
+ ID int64
+ Rake PokerChip
+ HandsPlayed int64
}
func (PokerCasino) TableName() string { return "poker_casino" }
@@ -20,6 +21,6 @@ func (d *DkfDB) GetPokerCasino() (out PokerCasino) {
}
func (d *DkfDB) IncrPokerCasinoRake(rake PokerChip) (err error) {
- err = d.db.Exec(`UPDATE poker_casino SET rake = rake + ? WHERE id = 1`, rake).Error
+ err = d.db.Exec(`UPDATE poker_casino SET rake = rake + ?, hands_played = hands_played + 1 WHERE id = 1`, rake).Error
return
}
diff --git a/pkg/web/public/views/pages/admin/poker-transactions.gohtml b/pkg/web/public/views/pages/admin/poker-transactions.gohtml
@@ -6,6 +6,7 @@
<div class="mb-3">
<table>
<tr><td>Rake:</td> <td>{{ .Data.PokerCasino.Rake }} <small>chips</small> | <span style="font-family: monospace;">{{ .Data.PokerCasino.Rake.ToPiconero.XmrStr }}</span> <small>XMR</small></td> <td>~{{ .Data.PokerCasino.Rake.ToPiconero.UsdStr }}</td></tr>
+ <tr><td>Hands played:</td> <td>{{ .Data.PokerCasino.HandsPlayed }}</td><td></td></tr>
<tr><td>Wallet balance:</td> <td><span style="font-family: monospace;">{{ .Data.Balance.XmrStr }}</span> <small>XMR</small></td> <td>~{{ .Data.Balance.UsdStr }}</td></tr>
<tr><td>Wallet unlocked balance:</td><td><span style="font-family: monospace;">{{ .Data.UnlockedBalance.XmrStr }}</span> <small>XMR</small></td><td>~{{ .Data.UnlockedBalance.UsdStr }}</td></tr>
<tr><td>Sum ins:</td> <td><span style="font-family: monospace;">{{ .Data.SumIn.XmrStr }}</span> <small>XMR</small></td> <td>~{{ .Data.SumIn.UsdStr }}</td></tr>