commit 2dfdb0ec235dc0ab78ed8cc90a7965b3813f4108
parent e8422b69a38ec230ff152bbb79f1cdb84eb4a320
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Thu, 14 Dec 2023 17:11:42 -0500
display players count
Diffstat:
3 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/pkg/web/handlers/data.go b/pkg/web/handlers/data.go
@@ -937,12 +937,17 @@ type chessData struct {
Color string
}
+type TmpTable struct {
+ database.PokerTable
+ NbSeated int
+}
+
type pokerData struct {
XmrBalanceStagenet database.Piconero
PokerXmrSubAddress string
Img string
ChipsTest database.PokerChip
- Tables []database.PokerTable
+ Tables []TmpTable
Transactions []database.PokerXmrTransaction
MinWithdrawAmount database.Piconero
WithdrawAmount database.Piconero
diff --git a/pkg/web/handlers/handlers.go b/pkg/web/handlers/handlers.go
@@ -9,6 +9,7 @@ import (
dutils "dkforest/pkg/database/utils"
"dkforest/pkg/odometer"
"dkforest/pkg/utils"
+ "dkforest/pkg/web/handlers/poker"
hutils "dkforest/pkg/web/handlers/utils"
"encoding/base64"
"fmt"
@@ -780,7 +781,14 @@ func PokerHomeHandler(c echo.Context) error {
data.WithdrawUnique = withdrawUnique
withdrawUniqueOrig, _ := pokerWithdrawCache.Get(authUser.ID)
pokerWithdrawCache.SetD(authUser.ID, withdrawUnique)
- data.Tables, _ = db.GetPokerTables()
+ pokerTables, _ := db.GetPokerTables()
+ for _, t := range pokerTables {
+ var nbSeated int
+ if g := poker.PokerInstance.GetGame(t.Slug); g != nil {
+ nbSeated = g.CountSeated()
+ }
+ data.Tables = append(data.Tables, TmpTable{PokerTable: t, NbSeated: nbSeated})
+ }
data.WithdrawAmount = minWithdrawAmount
if authUser.PokerXmrSubAddress != "" {
b, _ := authUser.GetImage()
diff --git a/pkg/web/public/views/pages/poker.gohtml b/pkg/web/public/views/pages/poker.gohtml
@@ -42,17 +42,19 @@
<table class="table table-novpadding table-sm table-hover table-striped">
<tr>
<th>Table</th>
+ <th>Players</th>
<th>Min/max buy-in</th>
<th>Type</th>
</tr>
{{ range .Data.Tables }}
<tr>
<td><a href="/poker/{{ .Slug }}">{{ .Name }}</a></td>
+ <td>{{ .NbSeated }}/6</td>
<td>{{ .MinBuyIn }} - {{ .MaxBuyIn }}</td>
<td>{{ if .IsTest }}FREE{{ else }}XMR{{ end }}</td>
</tr>
{{ else }}
- <tr><td colspan="3"><em>No table to show</em></td></tr>
+ <tr><td colspan="4"><em>No table to show</em></td></tr>
{{ end }}
</table>