From 9d449f0b87e55cd10128f6e7dbd0be3ac399f17f Mon Sep 17 00:00:00 2001 From: Patrick Fairbank Date: Mon, 7 Jul 2014 21:36:16 -0700 Subject: [PATCH] Removed fake results generator, now that match review works. --- match_play.go | 33 --------------------------------- templates/match_play.html | 5 +---- web.go | 1 - 3 files changed, 1 insertion(+), 38 deletions(-) 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 @@ {{$match.DisplayName}} {{$match.Time}} - - - Generate Fake Result - + Load diff --git a/web.go b/web.go index 1741ff2..4df2497 100644 --- a/web.go +++ b/web.go @@ -121,7 +121,6 @@ func newHandler() http.Handler { router.HandleFunc("/setup/alliance_selection/finalize", AllianceSelectionFinalizeHandler).Methods("POST") router.HandleFunc("/match_play", MatchPlayHandler).Methods("GET") router.HandleFunc("/match_play/{matchId}/load", MatchPlayLoadHandler).Methods("GET") - router.HandleFunc("/match_play/{matchId}/generate_fake_result", MatchPlayFakeResultHandler).Methods("GET") router.HandleFunc("/match_play/websocket", MatchPlayWebsocketHandler).Methods("GET") router.HandleFunc("/match_review", MatchReviewHandler).Methods("GET") router.HandleFunc("/match_review/{matchId}/edit", MatchReviewEditGetHandler).Methods("GET")