fix editscoreview yes

add menu to change name
sync3
Razmig Sarkissian 2 months ago
parent 28973c4bcf
commit f67f283b5e
  1. 2
      PadelClubData/Data/TeamRegistration.swift
  2. 19
      PadelClubData/Data/Tournament.swift

@ -256,7 +256,7 @@ final public class TeamRegistration: BaseTeamRegistration, SideStorable {
public func teamLabel(
_ displayStyle: DisplayStyle = .wide, twoLines: Bool = false, separator: String = "&"
) -> String {
if let name { return name }
if let name, name.isEmpty == false { return name }
return players().map { $0.playerLabel(displayStyle) }.joined(
separator: twoLines ? "\n" : " \(separator) ")
}

@ -345,6 +345,7 @@ defer {
public func availableSeedOpponentSpot(inRoundIndex roundIndex: Int) -> [Match] {
return getRound(atRoundIndex: roundIndex)?.playedMatches().filter { $0.hasSpaceLeft() } ?? []
}
public func availableSeedGroups(includeAll: Bool = false) -> [SeedInterval] {
let seeds = seeds()
var availableSeedGroup = Set<SeedInterval>()
@ -362,6 +363,24 @@ defer {
return availableSeedGroup.sorted(by: <)
}
public func generateSeedGroups(base: Int, teamCount: Int) -> [SeedInterval] {
let start = base + 1
let root = SeedInterval(first: start, last: start + teamCount - 1)
var groups: [SeedInterval] = []
func split(interval: SeedInterval) {
groups.append(interval)
if let chunks = interval.chunks() {
for chunk in chunks {
split(interval: chunk)
}
}
}
split(interval: root)
return groups.sorted(by: <)
}
public func chunksBy(in chunks: [SeedInterval], availableSeedGroup: inout Set<SeedInterval>) {
chunks.forEach { chunk in
availableSeedGroup.insert(chunk)

Loading…
Cancel
Save