Implemented radio button system for entering the games. Production mode
This commit is contained in:
@@ -12,6 +12,6 @@ clear_on_rebuild = true
|
||||
keep_scroll = true
|
||||
|
||||
[proxy]
|
||||
enabled = true
|
||||
enabled = false
|
||||
proxy_port = 8090
|
||||
app_port = 18765
|
||||
|
||||
@@ -48,9 +48,15 @@ func postEnter(c *gin.Context) {
|
||||
tableSlug := sess.Get("TableSlug")
|
||||
|
||||
var slug string
|
||||
var t *Table
|
||||
if tableSlug != nil {
|
||||
slug = tableSlug.(string)
|
||||
|
||||
if slug != "" {
|
||||
// Get the current table
|
||||
db.Model(&Table{}).Where("slug = ?", slug).First(&t)
|
||||
} else {
|
||||
t = nil
|
||||
}
|
||||
}
|
||||
|
||||
// Parse form
|
||||
@@ -153,10 +159,6 @@ func postEnter(c *gin.Context) {
|
||||
// Create game
|
||||
var g Game
|
||||
|
||||
// Get the current table
|
||||
var t Table
|
||||
db.Model(&Table{}).Where("slug = ?", slug).First(&t)
|
||||
|
||||
if slug != "" {
|
||||
g = Game{
|
||||
ScoreA: scoreA,
|
||||
@@ -208,8 +210,6 @@ func postEnter(c *gin.Context) {
|
||||
log.Println(err)
|
||||
}
|
||||
|
||||
log.Println(p.dElo)
|
||||
|
||||
if err := db.Create(&GameUser{GameID: g.ID, UserID: p.u.ID, Side: p.side, DeltaElo: p.dElo}).Error; err != nil {
|
||||
c.String(http.StatusInternalServerError, "failed to assign player")
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user