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
|
keep_scroll = true
|
||||||
|
|
||||||
[proxy]
|
[proxy]
|
||||||
enabled = true
|
enabled = false
|
||||||
proxy_port = 8090
|
proxy_port = 8090
|
||||||
app_port = 18765
|
app_port = 18765
|
||||||
|
|||||||
@@ -48,9 +48,15 @@ func postEnter(c *gin.Context) {
|
|||||||
tableSlug := sess.Get("TableSlug")
|
tableSlug := sess.Get("TableSlug")
|
||||||
|
|
||||||
var slug string
|
var slug string
|
||||||
|
var t *Table
|
||||||
if tableSlug != nil {
|
if tableSlug != nil {
|
||||||
slug = tableSlug.(string)
|
slug = tableSlug.(string)
|
||||||
|
if slug != "" {
|
||||||
|
// Get the current table
|
||||||
|
db.Model(&Table{}).Where("slug = ?", slug).First(&t)
|
||||||
|
} else {
|
||||||
|
t = nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse form
|
// Parse form
|
||||||
@@ -153,10 +159,6 @@ func postEnter(c *gin.Context) {
|
|||||||
// Create game
|
// Create game
|
||||||
var g Game
|
var g Game
|
||||||
|
|
||||||
// Get the current table
|
|
||||||
var t Table
|
|
||||||
db.Model(&Table{}).Where("slug = ?", slug).First(&t)
|
|
||||||
|
|
||||||
if slug != "" {
|
if slug != "" {
|
||||||
g = Game{
|
g = Game{
|
||||||
ScoreA: scoreA,
|
ScoreA: scoreA,
|
||||||
@@ -208,8 +210,6 @@ func postEnter(c *gin.Context) {
|
|||||||
log.Println(err)
|
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 {
|
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")
|
c.String(http.StatusInternalServerError, "failed to assign player")
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user