Update match review for 2019.

This commit is contained in:
Patrick Fairbank
2019-07-26 23:00:11 -07:00
parent ad1891cd91
commit 23bdfe9bf6
5 changed files with 260 additions and 261 deletions

View File

@@ -62,18 +62,17 @@ func TestMatchReviewEditExistingResult(t *testing.T) {
assert.Contains(t, recorder.Body.String(), "QF4-3")
// Update the score to something else.
postBody := "redScoreJson={\"AutoRuns\":3}&blueScoreJson={\"VaultCubes\":3," +
postBody := "redScoreJson={\"RobotEndLevels\":[0,3,0]}&blueScoreJson={\"CargoBays\":[0,2,1,2,2,0,1]," +
"\"Fouls\":[{\"TeamId\":973,\"Rule\":\"G22\"}]}&redCardsJson={\"105\":\"yellow\"}&blueCardsJson={}"
recorder = web.postHttpResponse(fmt.Sprintf("/match_review/%d/edit", match.Id), postBody)
assert.Equal(t, 303, recorder.Code)
// TODO(pat): Update for 2019.
// Check for the updated scores back on the match list page.
recorder = web.getHttpResponse("/match_review")
assert.Equal(t, 200, recorder.Code)
assert.Contains(t, recorder.Body.String(), "QF4-3")
assert.Contains(t, recorder.Body.String(), "5") // The red score
assert.Contains(t, recorder.Body.String(), "0") // The blue score
assert.Contains(t, recorder.Body.String(), "17") // The red score
assert.Contains(t, recorder.Body.String(), "19") // The blue score
}
func TestMatchReviewCreateNewResult(t *testing.T) {

View File

@@ -49,6 +49,19 @@ func NewWeb(arena *field.Arena) *Web {
}
return dict, nil
},
"add": func(a, b int) int {
return a + b
},
"multiply": func(a, b int) int {
return a * b
},
"seq": func(count int) []int {
seq := make([]int, count)
for i := 0; i < count; i++ {
seq[i] = i + 1
}
return seq
},
}
return web