mirror of
https://github.com/Team254/cheesy-arena-lite.git
synced 2026-03-09 21:56:50 -04:00
Removed fake results generator, now that match review works.
This commit is contained in:
@@ -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}}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user