|
|
|
|
@ -43,7 +43,7 @@ extension Tournament { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func addTeam(_ players: Set<PlayerRegistration>, registrationDate: Date? = nil, name: String? = nil) -> TeamRegistration { |
|
|
|
|
let team = TeamRegistration(tournament: id, registrationDate: registrationDate, name: name) |
|
|
|
|
let team = TeamRegistration(tournament: id, registrationDate: registrationDate ?? Date(), name: name) |
|
|
|
|
team.setWeight(from: Array(players), inTournamentCategory: tournamentCategory) |
|
|
|
|
players.forEach { player in |
|
|
|
|
player.teamRegistration = team.id |
|
|
|
|
@ -76,7 +76,7 @@ extension Tournament { |
|
|
|
|
guard let tournamentStore = self.tournamentStore else { return } |
|
|
|
|
|
|
|
|
|
let teams = (0..<count).map { _ in |
|
|
|
|
let team = TeamRegistration(tournament: id) |
|
|
|
|
let team = TeamRegistration(tournament: id, registrationDate: Date()) |
|
|
|
|
team.setWeight(from: [], inTournamentCategory: self.tournamentCategory) |
|
|
|
|
return team |
|
|
|
|
} |
|
|
|
|
@ -90,7 +90,7 @@ extension Tournament { |
|
|
|
|
|
|
|
|
|
func addWildCard(_ count: Int, _ type: MatchType) { |
|
|
|
|
let wcs = (0..<count).map { _ in |
|
|
|
|
let team = TeamRegistration(tournament: id) |
|
|
|
|
let team = TeamRegistration(tournament: id, registrationDate: Date()) |
|
|
|
|
if type == .bracket { |
|
|
|
|
team.wildCardBracket = true |
|
|
|
|
} else { |
|
|
|
|
|