Removed fake results generator, now that match review works.

This commit is contained in:
Patrick Fairbank
2014-07-07 21:36:16 -07:00
parent eb4900f981
commit 9d449f0b87
3 changed files with 1 additions and 38 deletions

View File

@@ -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}}
}