fix more stuff on loser round

multistore
Razmig Sarkissian 2 years ago
parent 38d05af6df
commit 34ceea6b2a
  1. 2
      PadelClub.xcodeproj/project.pbxproj
  2. 21
      PadelClub/Data/Match.swift
  3. 83
      PadelClub/Data/Round.swift
  4. 21
      PadelClub/Data/Tournament.swift
  5. 4
      PadelClub/Manager/PadelRule.swift
  6. 13
      PadelClub/ViewModel/SeedInterval.swift
  7. 42
      PadelClub/Views/Components/GenericDestinationPickerView.swift
  8. 5
      PadelClub/Views/Match/MatchRowView.swift
  9. 21
      PadelClub/Views/Match/MatchSetupView.swift
  10. 2
      PadelClub/Views/Round/LoserRoundView.swift
  11. 101
      PadelClub/Views/Round/LoserRoundsView.swift
  12. 14
      PadelClub/Views/Round/RoundView.swift
  13. 2
      PadelClub/Views/Team/TeamPickerView.swift
  14. 22
      PadelClub/Views/Tournament/TournamentRunningView.swift
  15. 2
      PadelClub/Views/Tournament/TournamentView.swift

@ -1731,6 +1731,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\"";
DEVELOPMENT_TEAM = BQ3Y44M3Q6;
ENABLE_PREVIEWS = YES;
@ -1762,6 +1763,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\"";
DEVELOPMENT_TEAM = BQ3Y44M3Q6;
ENABLE_PREVIEWS = YES;

@ -166,15 +166,14 @@ class Match: ModelObject, Storable {
return roundObject?.loserRounds().first?.getMatch(atMatchIndexInRound: indexInRound / 2)
}
private func _toggleLoserMatchDisableState(_ state: Bool) {
func _toggleLoserMatchDisableState(_ state: Bool) {
guard let loserMatch = _loserMatch() else { return }
loserMatch.byeState = state
loserMatch._toggleMatchDisableState(state, forward: true)
guard let otherMatch = _otherMatch() else { return }
if otherMatch.disabled == state {
loserMatch.byeState = !state
guard let next = _otherMatch() else { return }
loserMatch.byeState = true
if next.disabled {
loserMatch.byeState = false
}
loserMatch._toggleMatchDisableState(state, forward: true)
}
fileprivate func _otherMatch() -> Match? {
@ -202,9 +201,7 @@ class Match: ModelObject, Storable {
if next.disabled && byeState == false && next.byeState == false {
forwardMatch.byeState = false
forwardMatch._toggleMatchDisableState(state, forward: true)
}
if byeState && next.byeState {
} else if byeState && next.byeState {
print("don't disable forward match")
forwardMatch.byeState = false
forwardMatch._toggleMatchDisableState(false, forward: true)
@ -233,10 +230,10 @@ class Match: ModelObject, Storable {
}
func _toggleMatchDisableState(_ state: Bool, forward: Bool = false) {
if disabled == state { return }
//if disabled == state { return }
disabled = state
//byeState = false
try? DataStore.shared.matches.addOrUpdate(instance: self)
//try? DataStore.shared.matches.addOrUpdate(instance: self)
_toggleLoserMatchDisableState(state)
if forward {

@ -92,26 +92,29 @@ class Round: ModelObject, Storable {
func seed(_ team: TeamPosition, inMatchIndex matchIndex: Int) -> TeamRegistration? {
return Store.main.filter(isIncluded: {
$0.tournament == tournament && $0.bracketPosition != nil
}).first(where: {
($0.bracketPosition! / 2) == matchIndex
$0.tournament == tournament
&& $0.bracketPosition != nil
&& ($0.bracketPosition! / 2) == matchIndex
&& ($0.bracketPosition! % 2) == team.rawValue
})
}).first
}
func seeds(inMatchIndex matchIndex: Int) -> [TeamRegistration] {
return Store.main.filter(isIncluded: {
$0.tournament == tournament && $0.bracketPosition != nil
}).filter({
($0.bracketPosition! / 2) == matchIndex
$0.tournament == tournament
&& $0.bracketPosition != nil
&& ($0.bracketPosition! / 2) == matchIndex
})
}
func seeds() -> [TeamRegistration] {
let initialMatchIndex = RoundRule.matchIndex(fromRoundIndex: index)
let numberOfMatches = RoundRule.numberOfMatches(forRoundIndex: index)
return Store.main.filter(isIncluded: {
$0.tournament == tournament && $0.bracketPosition != nil
}).filter({
($0.bracketPosition! / 2) >= RoundRule.matchIndex(fromRoundIndex: index) && ($0.bracketPosition! / 2) < RoundRule.matchIndex(fromRoundIndex: index) + RoundRule.numberOfMatches(forRoundIndex: index)
$0.tournament == tournament
&& $0.bracketPosition != nil
&& ($0.bracketPosition! / 2) >= initialMatchIndex
&& ($0.bracketPosition! / 2) < initialMatchIndex + numberOfMatches
})
}
@ -246,8 +249,8 @@ class Round: ModelObject, Storable {
}
func getActiveLoserRound() -> Round? {
let rounds = loserRounds()
return rounds.filter({ $0.hasStarted() && $0.hasEnded() == false && $0.isDisabled() == false }).sorted(by: \.index).reversed().first ?? rounds.first(where: { $0.isDisabled() == false })
let rounds = loserRounds().filter({ $0.isDisabled() == false }).sorted(by: \.index).reversed()
return rounds.first(where: { $0.hasStarted() && $0.hasEnded() == false }) ?? rounds.first
}
func enableRound() {
@ -299,31 +302,43 @@ class Round: ModelObject, Storable {
func correspondingLoserRoundTitle(_ displayStyle: DisplayStyle = .wide) -> String {
if let parentRound, let initialRound = parentRound.initialRound() {
let parentMatchCount = parentRound.cumulativeMatchCount - initialRound.playedMatches().count
// print("initialRound", initialRound.roundTitle())
if let initialRoundNextRound = initialRound.nextRound() {
let total = initialRoundNextRound.playedMatches().count * 2 + initialRoundNextRound.disabledMatches().count
let previousRoundMatchCount = (previousRound() ?? parentRound).playedMatches().count
let seedInterval = SeedInterval(first: parentMatchCount + total + 1, last: parentMatchCount + total + previousRoundMatchCount).localizedLabel(displayStyle)
// print("seedInterval", seedInterval, parentMatchCount, total, previousRoundMatchCount)
return seedInterval
}
let initialMatchIndexFromRoundIndex = RoundRule.matchIndex(fromRoundIndex: index)
let seedsAfterThisRound : [TeamRegistration] = Store.main.filter(isIncluded: {
$0.tournament == tournament
&& $0.bracketPosition != nil
&& ($0.bracketPosition! / 2) < initialMatchIndexFromRoundIndex
})
let playedMatches = playedMatches()
let seedInterval = SeedInterval(first: playedMatches.count + seedsAfterThisRound.count + 1, last: playedMatches.count * 2 + seedsAfterThisRound.count)
return seedInterval.localizedLabel(displayStyle)
}
func seedInterval() -> SeedInterval? {
if loser == nil {
let numberOfMatches = RoundRule.numberOfMatches(forRoundIndex: index + 1)
let initialMatchIndexFromRoundIndex = RoundRule.matchIndex(fromRoundIndex: index)
let seedsAfterThisRound : [TeamRegistration] = Store.main.filter(isIncluded: {
$0.tournament == tournament
&& $0.bracketPosition != nil
&& ($0.bracketPosition! / 2) < initialMatchIndexFromRoundIndex
})
let playedMatches = playedMatches()
let reduce = numberOfMatches / 2 - (playedMatches.count + seedsAfterThisRound.count)
return SeedInterval(first: 1, last: numberOfMatches, reduce: reduce)
}
return RoundRule.roundName(fromRoundIndex: index)
if let previousRound = previousRound() {
return previousRound.seedInterval()?.chunks()?.first
} else if let parentRound = parentRound {
return parentRound.seedInterval()?.chunks()?.last
}
return nil
}
func roundTitle(_ displayStyle: DisplayStyle = .wide) -> String {
if let parentRound, let initialRound = parentRound.initialRound() {
let parentMatchCount = parentRound.theoryCumulativeMatchCount - RoundRule.numberOfMatches(forRoundIndex: initialRound.index)
// print("initialRound", initialRound.roundTitle())
if let initialRoundNextRound = initialRound.nextRound() {
let total = initialRoundNextRound.playedMatches().count * 2 + initialRoundNextRound.disabledMatches().count
let previousRoundMatchCount = RoundRule.numberOfMatches(forRoundIndex: (previousRound() ?? parentRound).index)
let seedInterval = SeedInterval(first: parentMatchCount + total + 1, last: parentMatchCount + total + previousRoundMatchCount).localizedLabel(displayStyle)
// print("seedInterval", seedInterval, parentMatchCount, total, previousRoundMatchCount)
return seedInterval
}
if loser != nil {
return seedInterval()?.localizedLabel(displayStyle) ?? "Pas trouvé"
}
return RoundRule.roundName(fromRoundIndex: index)
}

@ -342,9 +342,13 @@ class Tournament : ModelObject, Storable {
}
}
func allRoundMatches() -> [Match] {
allRounds().flatMap { $0._matches() }
}
func allMatches() -> [Match] {
let unsortedGroupStages : [GroupStage] = Store.main.filter { $0.tournament == self.id }
let matches: [Match] = unsortedGroupStages.flatMap { $0._matches() } + allRounds().flatMap { $0._matches() }
let matches: [Match] = unsortedGroupStages.flatMap { $0._matches() } + allRoundMatches()
return matches.filter({ $0.disabled == false })
}
@ -742,24 +746,27 @@ class Tournament : ModelObject, Storable {
let selectedPlayers = selectedPlayers()
let paid = selectedPlayers.filter({ $0.hasPaid() })
let label = paid.count.formatted() + " / " + selectedPlayers.count.formatted() + " joueurs encaissés"
let completion = (Double(paid.count) / Double(selectedPlayers.count)).formatted(.percent.precision(.fractionLength(0)))
return TournamentStatus(label: label, completion: completion)
let completion = (Double(paid.count) / Double(selectedPlayers.count))
let completionLabel = completion.isNaN ? "" : completion.formatted(.percent.precision(.fractionLength(0)))
return TournamentStatus(label: label, completion: completionLabel)
}
func scheduleStatus() -> TournamentStatus {
let allMatches = allMatches()
let ready = allMatches.filter({ $0.startDate != nil })
let label = ready.count.formatted() + " / " + allMatches.count.formatted() + " matchs programmés"
let completion = (Double(ready.count) / Double(allMatches.count)).formatted(.percent.precision(.fractionLength(0)))
return TournamentStatus(label: label, completion: completion)
let completion = (Double(ready.count) / Double(allMatches.count))
let completionLabel = completion.isNaN ? "" : completion.formatted(.percent.precision(.fractionLength(0)))
return TournamentStatus(label: label, completion: completionLabel)
}
func callStatus() -> TournamentStatus {
let selectedSortedTeams = selectedSortedTeams()
let called = selectedSortedTeams.filter{ $0.called() }
let label = called.count.formatted() + " / " + selectedSortedTeams.count.formatted() + " paires convoquées"
let completion = (Double(called.count) / Double(selectedSortedTeams.count)).formatted(.percent.precision(.fractionLength(0)))
return TournamentStatus(label: label, completion: completion)
let completion = (Double(called.count) / Double(selectedSortedTeams.count))
let completionLabel = completion.isNaN ? "" : completion.formatted(.percent.precision(.fractionLength(0)))
return TournamentStatus(label: label, completion: completionLabel)
}
func bracketStatus() -> String {

@ -797,10 +797,12 @@ enum TournamentType: Int, Hashable, Codable, CaseIterable, Identifiable {
}
}
enum TeamPosition: Int, Hashable, Codable, CaseIterable {
enum TeamPosition: Int, Identifiable, Hashable, Codable, CaseIterable {
case one
case two
var id: Int { self.rawValue }
var otherTeam: TeamPosition {
switch self {
case .one:

@ -10,24 +10,25 @@ import Foundation
struct SeedInterval: Hashable, Comparable {
let first: Int
let last: Int
var reduce: Int = 0
static func <(lhs: SeedInterval, rhs: SeedInterval) -> Bool {
return lhs.first < rhs.first
}
var count: Int {
dimension + 1
dimension
}
private var dimension: Int {
(last - first)
(last - (first - 1))
}
func chunks() -> [SeedInterval]? {
if dimension > 3 {
let split = dimension / 2
let firstHalf = SeedInterval(first: first, last: first + split - 1)
let secondHalf = SeedInterval(first: first + split, last: last)
let firstHalf = SeedInterval(first: first, last: first + split - 1, reduce: reduce)
let secondHalf = SeedInterval(first: first + split, last: last, reduce: reduce)
return [firstHalf, secondHalf]
} else {
return nil
@ -36,9 +37,9 @@ struct SeedInterval: Hashable, Comparable {
func localizedLabel(_ displayStyle: DisplayStyle = .wide) -> String {
if dimension < 2 {
return "#\(first) / #\(last)"
return "#\(first - reduce) / #\(last - reduce)"
} else {
return "#\(first) à #\(last)"
return "#\(first - reduce) à #\(last - reduce)"
}
}
}

@ -44,27 +44,27 @@ struct GenericDestinationPickerView<T: Identifiable & Selectable>: View {
.opacity(selectedDestination?.id == destination.id ? 1.0 : 0.4)
}
.buttonStyle(.plain)
.overlay(alignment: .bottomTrailing) {
if let badge = destination.badgeImage() {
Image(systemName: badge.systemName())
.foregroundColor(badge.color())
.imageScale(.medium)
.background (
Color(.systemBackground)
.clipShape(.circle)
)
.offset(x: 3, y: 3)
} else if let count = destination.badgeValue(), count > 0 {
Image(systemName: count <= 50 ? "\(count).circle.fill" : "plus.circle.fill")
.foregroundColor(.red)
.imageScale(.medium)
.background (
Color(.systemBackground)
.clipShape(.circle)
)
.offset(x: 3, y: 3)
}
}
// .overlay(alignment: .bottomTrailing) {
// if let badge = destination.badgeImage() {
// Image(systemName: badge.systemName())
// .foregroundColor(badge.color())
// .imageScale(.medium)
// .background (
// Color(.systemBackground)
// .clipShape(.circle)
// )
// .offset(x: 3, y: 3)
// } else if let count = destination.badgeValue(), count > 0 {
// Image(systemName: count <= 50 ? "\(count).circle.fill" : "plus.circle.fill")
// .foregroundColor(.red)
// .imageScale(.medium)
// .background (
// Color(.systemBackground)
// .clipShape(.circle)
// )
// .offset(x: 3, y: 3)
// }
// }
}
}
.fixedSize()

@ -48,8 +48,11 @@ struct MatchRowView: View {
// Button("toggle fwrd match") {
// match._toggleForwardMatchDisableState(true)
// }
// Button("toggle loser match") {
// match._toggleLoserMatchDisableState(true)
// }
// })
//
NavigationLink {
MatchDetailView(match: match, matchViewStyle: matchViewStyle)
} label: {

@ -14,8 +14,17 @@ struct MatchSetupView: View {
@ViewBuilder
var body: some View {
_teamView(inTeamPosition: .one)
_teamView(inTeamPosition: .two)
ForEach(TeamPosition.allCases) { teamPosition in
VStack(alignment: .leading) {
if teamPosition == .one {
Text("Branche du haut")
}
_teamView(inTeamPosition: teamPosition)
if teamPosition == .two {
Text("Branche du bas")
}
}
}
}
@ViewBuilder
@ -33,6 +42,7 @@ struct MatchSetupView: View {
if match.isSeededBy(team: team, inTeamPosition: teamPosition) {
team.bracketPosition = nil
match.enableMatch()
try? dataStore.matches.addOrUpdate(instance: match)
try? dataStore.teamRegistrations.addOrUpdate(instance: team)
} else {
match.teamWillBeWalkOut(team)
@ -88,7 +98,7 @@ struct MatchSetupView: View {
}
}
} label: {
Text("Tirage").tag(nil as SeedInterval?)
Text("Tirer au sort").tag(nil as SeedInterval?)
}
.disabled(availableSeedGroups.isEmpty && walkOutSpot == false)
@ -106,9 +116,8 @@ struct MatchSetupView: View {
}
}
.fixedSize(horizontal: false, vertical: true)
.buttonBorderShape(.capsule)
.buttonStyle(.borderedProminent)
.buttonStyle(.borderless)
.underline()
}
}
}

@ -29,7 +29,7 @@ struct LoserRoundView: View {
ForEach(matches) { match in
MatchRowView(match: match, matchViewStyle: .standardStyle)
.overlay {
if match.disabled && isEditingTournamentSeed {
if match.disabled /*&& isEditingTournamentSeed*/ {
Image(systemName: "xmark")
.resizable()
.scaledToFit()

@ -7,37 +7,44 @@
import SwiftUI
enum LoserRound: Identifiable, Selectable {
case round(turnIndex: Int, rounds: [Round])
struct LoserRound: Identifiable, Selectable {
let turnIndex: Int
let rounds: [Round]
var id: Int {
switch self {
case .round(let turnIndex, _):
return turnIndex
return turnIndex
}
static func updateDestinations(fromLoserRounds loserRounds: [Round], inUpperBracketRound upperBracketRound: Round) -> [LoserRound] {
var rounds = [LoserRound]()
for (index, round) in loserRounds.enumerated() {
rounds.append(LoserRound(turnIndex: index, rounds: upperBracketRound.loserRounds(forRoundIndex: round.index)))
}
return rounds
}
static func enabledLoserRounds(inLoserRounds loserRounds: [Round], inUpperBracketRound upperBracketRound: Round) -> [Round] {
return loserRounds.filter { loserRound in
upperBracketRound.loserRounds(forRoundIndex: loserRound.index).anySatisfy({ $0.isDisabled() == false })
}
}
}
extension LoserRound {
func selectionLabel() -> String {
switch self {
case .round(let turnIndex, _):
return "Tour #\(turnIndex + 1)"
}
return "Tour #\(turnIndex + 1)"
}
func badgeValue() -> Int? {
switch self {
case .round(_, let rounds):
return rounds.flatMap { $0.playedMatches() }.filter({ $0.isRunning() }).count
}
return rounds.flatMap { $0.playedMatches() }.filter({ $0.isRunning() }).count
}
func badgeImage() -> Badge? {
switch self {
case .round(_, let rounds):
return rounds.allSatisfy({ $0.hasEnded() }) ? .checkmark : nil
}
return rounds.allSatisfy({ $0.hasEnded() }) ? .checkmark : nil
}
}
@ -47,54 +54,34 @@ struct LoserRoundsView: View {
var upperBracketRound: Round
@State private var selectedRound: LoserRound?
let loserRounds: [Round]
@State private var allDestinations: [LoserRound]
init(upperBracketRound: Round) {
self.upperBracketRound = upperBracketRound
self.loserRounds = upperBracketRound.loserRounds()
// _selectedRound = State(wrappedValue: upperBracketRound.getActiveLoserRound())
let _loserRounds = upperBracketRound.loserRounds()
self.loserRounds = _loserRounds
let enabledLoserRounds = LoserRound.enabledLoserRounds(inLoserRounds: _loserRounds, inUpperBracketRound: upperBracketRound)
let rounds = LoserRound.updateDestinations(fromLoserRounds: enabledLoserRounds, inUpperBracketRound: upperBracketRound)
_allDestinations = State(wrappedValue: rounds)
_selectedRound = State(wrappedValue: rounds.first(where: { $0.rounds.anySatisfy({ $0.getActiveLoserRound() != nil }) }) ?? rounds.first)
}
func allDestinations() -> [LoserRound] {
// return loserRounds
if isEditingTournamentSeed.wrappedValue == false {
let loserRounds = loserRounds.filter { loserRound in
upperBracketRound.loserRounds(forRoundIndex: loserRound.index).anySatisfy({ $0.isDisabled() == false })
}
var rounds = [LoserRound]()
for (index, round) in loserRounds.enumerated() {
rounds.append(LoserRound.round(turnIndex: index, rounds: upperBracketRound.loserRounds(forRoundIndex: round.index)))
}
return rounds
} else {
var rounds = [LoserRound]()
for (index, round) in loserRounds.enumerated() {
rounds.append(LoserRound.round(turnIndex: index, rounds: upperBracketRound.loserRounds(forRoundIndex: round.index)))
}
return rounds
}
}
var body: some View {
VStack(spacing: 0) {
GenericDestinationPickerView(selectedDestination: $selectedRound, destinations: allDestinations(), nilDestinationIsValid: true)
switch selectedRound {
case .none:
List {
RowButtonView("Effacer", role: .destructive) {
}
}
case .some(let selectedRound):
switch selectedRound {
case .round(_, let rounds):
LoserRoundView(loserRounds: rounds)
}
}
GenericDestinationPickerView(selectedDestination: $selectedRound, destinations: allDestinations, nilDestinationIsValid: false)
LoserRoundView(loserRounds: selectedRound!.rounds)
}
.navigationBarTitleDisplayMode(.inline)
.toolbarBackground(.visible, for: .navigationBar)
.onChange(of: isEditingTournamentSeed.wrappedValue) {
_updateDestinations()
}
}
private func _updateDestinations() {
let enabledLoserRounds = isEditingTournamentSeed.wrappedValue ? loserRounds : LoserRound.enabledLoserRounds(inLoserRounds: loserRounds, inUpperBracketRound: upperBracketRound)
self.allDestinations = LoserRound.updateDestinations(fromLoserRounds: enabledLoserRounds, inUpperBracketRound: upperBracketRound)
}
}

@ -21,7 +21,7 @@ struct RoundView: View {
let loserRounds = round.loserRounds()
//(where: { $0.isDisabled() == false || isEditingTournamentSeed.wrappedValue })
if loserRounds.isEmpty == false, let first = loserRounds.first {
let correspondingLoserRoundTitle = first.correspondingLoserRoundTitle()
let correspondingLoserRoundTitle = round.correspondingLoserRoundTitle()
Section {
NavigationLink {
LoserRoundsView(upperBracketRound: round)
@ -36,9 +36,8 @@ struct RoundView: View {
RowButtonView("Placer \(availableSeedGroup.localizedLabel())") {
tournament.setSeeds(inRoundIndex: round.index, inSeedGroup: availableSeedGroup)
try? dataStore.teamRegistrations.addOrUpdate(contentOfs: tournament.seeds())
if tournament.availableSeeds().isEmpty {
_save()
self.isEditingTournamentSeed.wrappedValue = false
}
}
@ -56,11 +55,20 @@ struct RoundView: View {
.toolbar {
ToolbarItem(placement: .topBarTrailing) {
Button(isEditingTournamentSeed.wrappedValue == true ? "Valider" : "Modifier") {
if isEditingTournamentSeed.wrappedValue {
_save()
}
isEditingTournamentSeed.wrappedValue.toggle()
}
}
}
}
private func _save() {
try? dataStore.teamRegistrations.addOrUpdate(contentOfs: tournament.seeds())
let allRoundMatches = tournament.allRoundMatches()
try? DataStore.shared.matches.addOrUpdate(contentOfs: allRoundMatches)
}
}
#Preview {

@ -23,7 +23,7 @@ struct TeamPickerView: View {
.sheet(isPresented: $presentTeamPickerView) {
NavigationStack {
List {
let teams = tournament.sortedTeams()
let teams = tournament.selectedSortedTeams()
if luckyLosers.isEmpty == false {
Section {
_teamListView(luckyLosers.sorted(by: \.weight))

@ -8,8 +8,14 @@
import SwiftUI
struct TournamentRunningView: View {
@Environment(Tournament.self) private var tournament: Tournament
var tournament: Tournament
var allMatches: [Match]
init(tournament: Tournament) {
self.tournament = tournament
self.allMatches = tournament.allMatches()
}
@ViewBuilder
var body: some View {
Section {
@ -68,15 +74,13 @@ struct TournamentRunningView: View {
}
}
let allMatches = tournament.allMatches()
MatchListView(section: "en cours", matches: tournament.runningMatches(allMatches)).id(UUID())
MatchListView(section: "disponible", matches: tournament.availableToStart(allMatches)).id(UUID())
MatchListView(section: "à lancer", matches: tournament.readyMatches(allMatches)).id(UUID())
MatchListView(section: "terminés", matches: tournament.finishedMatches(allMatches)).id(UUID())
MatchListView(section: "en cours", matches: tournament.runningMatches(allMatches))
//MatchListView(section: "disponible", matches: tournament.availableToStart(allMatches))
//MatchListView(section: "à lancer", matches: tournament.readyMatches(allMatches))
MatchListView(section: "terminés", matches: tournament.finishedMatches(allMatches))
}
}
#Preview {
TournamentRunningView()
.environment(Tournament.mock())
TournamentRunningView(tournament: Tournament.mock())
}

@ -66,7 +66,7 @@ struct TournamentView: View {
case .initial:
TournamentInitView()
case .build:
TournamentRunningView()
TournamentRunningView(tournament: tournament)
}
}
.toolbarBackground(.visible, for: .navigationBar)

Loading…
Cancel
Save