From 41b62a73aedca0b74b14e1cb99f6b0bcf08cb39c Mon Sep 17 00:00:00 2001 From: Raz Date: Tue, 12 Nov 2024 10:27:50 +0100 Subject: [PATCH] update matches --- .../Views/Tournament/TournamentRunningView.swift | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/PadelClub/Views/Tournament/TournamentRunningView.swift b/PadelClub/Views/Tournament/TournamentRunningView.swift index 0ce2fa0..d28620a 100644 --- a/PadelClub/Views/Tournament/TournamentRunningView.swift +++ b/PadelClub/Views/Tournament/TournamentRunningView.swift @@ -22,17 +22,22 @@ struct TournamentRunningView: View { let runningMatches = Tournament.runningMatches(allMatches) let matchesLeft = Tournament.matchesLeft(allMatches) let readyMatches = Tournament.readyMatches(allMatches) + let availableToStart = Tournament.availableToStart(allMatches, in: runningMatches, checkCanPlay: true) Section { - MatchListView(section: "prêt à démarrer", matches: readyMatches, hideWhenEmpty: tournament.hasEnded(), isExpanded: true) + MatchListView(section: "prêt à démarrer", matches: availableToStart, hideWhenEmpty: tournament.hasEnded(), isExpanded: true) } Section { - MatchListView(section: "à venir", matches: matchesLeft, hideWhenEmpty: true, isExpanded: false) + MatchListView(section: "à lancer", matches: readyMatches, hideWhenEmpty: tournament.hasEnded(), isExpanded: availableToStart.isEmpty) + } + + Section { + MatchListView(section: "à venir", matches: matchesLeft, hideWhenEmpty: true, isExpanded: readyMatches.isEmpty) } Section { - MatchListView(section: "en cours", matches: runningMatches, hideWhenEmpty: tournament.hasEnded(), isExpanded: false) + MatchListView(section: "en cours", matches: runningMatches, hideWhenEmpty: tournament.hasEnded(), isExpanded: matchesLeft.isEmpty) } Section {