mirror of
https://github.com/Team254/cheesy-arena-lite.git
synced 2026-03-09 13:46:44 -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}}
|
||||
}
|
||||
|
||||
@@ -30,10 +30,7 @@
|
||||
<tr class="{{$match.ColorClass}}">
|
||||
<td>{{$match.DisplayName}}</td>
|
||||
<td>{{$match.Time}}</td>
|
||||
<td class="text-center" style="white-space: nowrap;">
|
||||
<a href="/match_play/{{$match.Id}}/generate_fake_result">
|
||||
<b class="btn btn-info btn-xs">Generate Fake Result</b>
|
||||
</a>
|
||||
<td style="white-space: nowrap;">
|
||||
<a href="/match_play/{{$match.Id}}/load">
|
||||
<b class="btn btn-info btn-xs">Load</b>
|
||||
</a>
|
||||
|
||||
1
web.go
1
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")
|
||||
|
||||
Reference in New Issue
Block a user