From a10bfd175ea7c2b66b4f686f4befea878bb64353 Mon Sep 17 00:00:00 2001 From: Brian Buller Date: Sun, 9 Jul 2017 20:19:15 -0500 Subject: [PATCH 1/2] Fixed voting validation issue --- templates/public-voting.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/templates/public-voting.html b/templates/public-voting.html index 54253b6..b586bc9 100644 --- a/templates/public-voting.html +++ b/templates/public-voting.html @@ -268,9 +268,11 @@ function getRanked() { function gameTableToArray(tbl) { var ret = []; var trs = snack.wrap('#'+tbl+'-table>tbody>tr') - if(trs[0].length > 0) { + if(trs.length > 0) { trs.each(function(ele, idx) { - ret = ret.concat(getTeamObj(ele.dataset.teamid)); + if(ele.dataset != null && ele.dataset.teamid != null) { + ret = ret.concat(getTeamObj(ele.dataset.teamid)); + } }); } return ret; From e27d244f9c64a2e1d3ef8ce3dc12859c434da6f2 Mon Sep 17 00:00:00 2001 From: Brian Buller Date: Sun, 9 Jul 2017 20:20:09 -0500 Subject: [PATCH 2/2] Remove debugging prints --- main.go | 1 - public_endpoints.go | 2 -- 2 files changed, 3 deletions(-) diff --git a/main.go b/main.go index 8a4eaca..12ddae7 100644 --- a/main.go +++ b/main.go @@ -261,7 +261,6 @@ func InitPageData(w http.ResponseWriter, req *http.Request) *pageData { if p.FlashClass == "" { p.FlashClass = "hidden" } - fmt.Println("Flash Message: " + p.FlashMessage + " (" + p.FlashClass + ")") // Build the menu if p.LoggedIn { diff --git a/public_endpoints.go b/public_endpoints.go index e7d89ae..1adcccc 100644 --- a/public_endpoints.go +++ b/public_endpoints.go @@ -1,7 +1,6 @@ package main import ( - "fmt" "math/rand" "net/http" "strings" @@ -37,7 +36,6 @@ func loadVotingPage(w http.ResponseWriter, req *http.Request) { rand.Seed(time.Now().Unix()) for len(tms) > 0 { i := rand.Intn(len(tms)) - fmt.Println("Chose Team: " + tms[i].Name) vpd.Teams = append(vpd.Teams, tms[i]) tms = append(tms[:i], tms[i+1:]...) }