mirror of
https://github.com/Team254/cheesy-arena-lite.git
synced 2026-03-09 21:56:50 -04:00
Add schedules for events having as few as six teams.
This commit is contained in:
@@ -75,8 +75,8 @@ func (web *Web) scheduleGeneratePostHandler(w http.ResponseWriter, r *http.Reque
|
||||
"generating the schedule.")
|
||||
return
|
||||
}
|
||||
if len(teams) < 18 {
|
||||
web.renderSchedule(w, r, fmt.Sprintf("There are only %d teams. There must be at least 18 teams to generate "+
|
||||
if len(teams) < 6 {
|
||||
web.renderSchedule(w, r, fmt.Sprintf("There are only %d teams. There must be at least 6 teams to generate "+
|
||||
"a schedule.", len(teams)))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -60,14 +60,14 @@ func TestSetupScheduleErrors(t *testing.T) {
|
||||
assert.Contains(t, recorder.Body.String(), "No team list is configured.")
|
||||
|
||||
// Insufficient number of teams.
|
||||
for i := 0; i < 17; i++ {
|
||||
for i := 0; i < 5; i++ {
|
||||
web.arena.Database.CreateTeam(&model.Team{Id: i + 101})
|
||||
}
|
||||
postData = "numScheduleBlocks=1&startTime0=2014-01-01 09:00:00 AM&numMatches0=7&matchSpacingSec0=480&" +
|
||||
"matchType=practice"
|
||||
recorder = web.postHttpResponse("/setup/schedule/generate", postData)
|
||||
assert.Equal(t, 200, recorder.Code)
|
||||
assert.Contains(t, recorder.Body.String(), "There must be at least 18 teams to generate a schedule.")
|
||||
assert.Contains(t, recorder.Body.String(), "There must be at least 6 teams to generate a schedule.")
|
||||
|
||||
// More matches per team than schedules exist for.
|
||||
web.arena.Database.CreateTeam(&model.Team{Id: 118})
|
||||
@@ -75,7 +75,7 @@ func TestSetupScheduleErrors(t *testing.T) {
|
||||
"matchType=practice"
|
||||
recorder = web.postHttpResponse("/setup/schedule/generate", postData)
|
||||
assert.Equal(t, 200, recorder.Code)
|
||||
assert.Contains(t, recorder.Body.String(), "No schedule template exists for 18 teams and 233 matches")
|
||||
assert.Contains(t, recorder.Body.String(), "No schedule template exists for 6 teams and 700 matches")
|
||||
|
||||
// Incomplete scheduling data received.
|
||||
postData = "numScheduleBlocks=1&startTime0=2014-01-01 09:00:00 AM&numMatches0=&matchSpacingSec0=480&" +
|
||||
|
||||
Reference in New Issue
Block a user