diff --git a/match_play.go b/match_play.go index 41050ef..cd25443 100644 --- a/match_play.go +++ b/match_play.go @@ -12,7 +12,6 @@ import ( "html/template" "io" "log" - "math/rand" "net/http" "sort" "strconv" @@ -104,32 +103,6 @@ func MatchPlayLoadHandler(w http.ResponseWriter, r *http.Request) { http.Redirect(w, r, "/match_play", 302) } -func MatchPlayFakeResultHandler(w http.ResponseWriter, r *http.Request) { - vars := mux.Vars(r) - matchId, _ := strconv.Atoi(vars["matchId"]) - match, err := db.GetMatchById(matchId) - if err != nil { - handleWebErr(w, err) - return - } - if match == nil { - handleWebErr(w, fmt.Errorf("Invalid match ID %d.", matchId)) - return - } - matchResult := MatchResult{MatchId: match.Id, RedFouls: []Foul{}, BlueFouls: []Foul{Foul{17, "G22", 23.5, true}}, - Cards: Cards{[]int{17}, []int{8}}} - matchResult.RedScore = randomScore() - matchResult.BlueScore = randomScore() - err = CommitMatchScore(match, &matchResult) - if err != nil { - handleWebErr(w, err) - return - } - currentMatchType = match.Type - - http.Redirect(w, r, "/match_play", 302) -} - // The websocket endpoint for the match play client to send control commands and receive status updates. func MatchPlayWebsocketHandler(w http.ResponseWriter, r *http.Request) { // Allow disabling of period updates, for easier testing. @@ -374,9 +347,3 @@ func buildMatchPlayList(matchType string) (MatchPlayList, error) { return matchPlayList, nil } - -func randomScore() Score { - cycle := Cycle{rand.Intn(3) + 1, rand.Intn(2) == 1, rand.Intn(2) == 1, rand.Intn(2) == 1, rand.Intn(2) == 1, - rand.Intn(2) == 1} - return Score{rand.Intn(4), rand.Intn(4), rand.Intn(4), rand.Intn(4), rand.Intn(4), 0, 0, []Cycle{cycle}} -} diff --git a/templates/match_play.html b/templates/match_play.html index 7cb324a..91cec76 100644 --- a/templates/match_play.html +++ b/templates/match_play.html @@ -30,10 +30,7 @@