fix issue with ts setup

sync_v2
Raz 8 months ago
parent 4a378f8737
commit fbd730eae6
  1. 17
      PadelClub/Data/Tournament.swift

@ -489,9 +489,20 @@ defer {
}) { }) {
return seedGroupAvailable(atRoundIndex: roundIndex, availableSeedGroup: chunk) return seedGroupAvailable(atRoundIndex: roundIndex, availableSeedGroup: chunk)
} else if fullLeftSeeds.count > 1, targetSpots > 1, fullLeftSeeds.count >= targetSpots { } else if fullLeftSeeds.count > 1, targetSpots > 1, fullLeftSeeds.count >= targetSpots {
let seeds = seeds() let currentSeeds = seeds()
if let firstIndex = seeds.firstIndex(where: { $0.isSeedable() }) { if let firstIndex = currentSeeds.firstIndex(where: { $0.isSeedable() }) {
return seedGroupAvailable(atRoundIndex: roundIndex, availableSeedGroup: SeedInterval(first: firstIndex + 1, last: firstIndex + targetSpots))
if firstIndex < seededTeamsCount {
return nil
} else {
let sg = SeedInterval(first: seededTeamsCount + 1, last: seededTeamsCount + targetSpots)
let futureAvailableSeeds = self.seeds(inSeedGroup: sg)
if futureAvailableSeeds.count >= targetSpots {
return seedGroupAvailable(atRoundIndex: roundIndex, availableSeedGroup: sg)
} else {
return nil
}
}
} }
} }
} }

Loading…
Cancel
Save