Refactor playoff bracket logic to more easily support alternative formats.

This commit is contained in:
Patrick Fairbank
2022-08-03 20:53:16 -07:00
parent 737972f494
commit bfc5e56fc9
15 changed files with 995 additions and 530 deletions

View File

@@ -48,7 +48,7 @@ const (
MatchNotPlayed MatchStatus = ""
)
var ElimRoundNames = map[int]string{1: "F", 2: "SF", 4: "QF", 8: "EF"}
var elimRoundNames = map[int]string{1: "F", 2: "SF", 4: "QF", 8: "EF"}
func (database *Database) CreateMatch(match *Match) error {
return database.matchTable.create(match)
@@ -153,7 +153,7 @@ func (match *Match) TbaCode() string {
if match.Type == "qualification" {
return fmt.Sprintf("qm%s", match.DisplayName)
} else if match.Type == "elimination" {
return fmt.Sprintf("%s%dm%d", strings.ToLower(ElimRoundNames[match.ElimRound]), match.ElimGroup,
return fmt.Sprintf("%s%dm%d", strings.ToLower(elimRoundNames[match.ElimRound]), match.ElimGroup,
match.ElimInstance)
}
return ""