Add schedules for events having as few as six teams.

This commit is contained in:
Patrick Fairbank
2021-05-30 19:16:13 -07:00
parent 39eac5cb24
commit f5bd112e5a
171 changed files with 2473 additions and 7 deletions

View File

@@ -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
}

View File

@@ -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&" +