Update alliance selection error message when picking a team who didn't play any qualification matches.

This commit is contained in:
Patrick Fairbank
2022-08-22 17:11:34 -07:00
parent 20cb056243
commit 4d3d270a0f
2 changed files with 8 additions and 2 deletions

View File

@@ -76,7 +76,13 @@ func (web *Web) allianceSelectionPostHandler(w http.ResponseWriter, r *http.Requ
}
}
if !found {
web.renderAllianceSelection(w, r, fmt.Sprintf("Team %d is not present at this event.", teamId))
web.renderAllianceSelection(
w,
r,
fmt.Sprintf(
"Team %d has not played any matches at this event and is ineligible for selection.", teamId,
),
)
return
}
}

View File

@@ -118,7 +118,7 @@ func TestAllianceSelectionErrors(t *testing.T) {
assert.Contains(t, recorder.Body.String(), "Invalid team number")
recorder = web.postHttpResponse("/alliance_selection", "selection0_0=100")
assert.Equal(t, 200, recorder.Code)
assert.Contains(t, recorder.Body.String(), "not present at this event")
assert.Contains(t, recorder.Body.String(), "ineligible for selection")
recorder = web.postHttpResponse("/alliance_selection", "selection0_0=101&selection1_1=101")
assert.Equal(t, 200, recorder.Code)
assert.Contains(t, recorder.Body.String(), "already part of an alliance")