From 17e0c85e0bd797cb8ffcb88ea6e5f5bdf29352a5 Mon Sep 17 00:00:00 2001 From: Raz Date: Fri, 15 Nov 2024 07:41:27 +0100 Subject: [PATCH] fix next matches display --- PadelClub.xcodeproj/project.pbxproj | 8 ++++---- PadelClub/Data/DataStore.swift | 11 ++++++----- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/PadelClub.xcodeproj/project.pbxproj b/PadelClub.xcodeproj/project.pbxproj index 05fb0bd..57ea77b 100644 --- a/PadelClub.xcodeproj/project.pbxproj +++ b/PadelClub.xcodeproj/project.pbxproj @@ -3254,7 +3254,7 @@ CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEFINES_MODULE = YES; DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\""; @@ -3278,7 +3278,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.30; + MARKETING_VERSION = 1.0.31; PRODUCT_BUNDLE_IDENTIFIER = app.padelclub; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -3299,7 +3299,7 @@ CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\""; DEVELOPMENT_TEAM = BQ3Y44M3Q6; @@ -3322,7 +3322,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.30; + MARKETING_VERSION = 1.0.31; PRODUCT_BUNDLE_IDENTIFIER = app.padelclub; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/PadelClub/Data/DataStore.swift b/PadelClub/Data/DataStore.swift index 9fc3e62..b83f56d 100644 --- a/PadelClub/Data/DataStore.swift +++ b/PadelClub/Data/DataStore.swift @@ -299,12 +299,13 @@ class DataStore: ObservableObject { func runningMatches() -> [Match] { let dateNow : Date = Date() - let lastTournaments = self.tournaments.filter { $0.isDeleted == false && $0.startDate <= dateNow }.sorted(by: \Tournament.startDate, order: .descending).prefix(10) + let lastTournaments = self.tournaments.filter { $0.isDeleted == false && $0.startDate <= dateNow && $0.hasEnded() == false }.sorted(by: \Tournament.startDate, order: .descending).prefix(10) var runningMatches: [Match] = [] for tournament in lastTournaments { let matches = tournament.tournamentStore.matches.filter { match in - match.isRunning() } + match.disabled == false && match.isRunning() + } runningMatches.append(contentsOf: matches) } return runningMatches @@ -313,12 +314,12 @@ class DataStore: ObservableObject { func runningAndNextMatches() -> [Match] { let dateNow : Date = Date() - let lastTournaments = self.tournaments.filter { $0.isDeleted == false && $0.startDate <= dateNow }.sorted(by: \Tournament.startDate, order: .descending).prefix(10) + let lastTournaments = self.tournaments.filter { $0.isDeleted == false && $0.startDate <= dateNow && $0.hasEnded() == false }.sorted(by: \Tournament.startDate, order: .descending).prefix(10) var runningMatches: [Match] = [] for tournament in lastTournaments { let matches = tournament.tournamentStore.matches.filter { match in - match.startDate != nil && match.endDate == nil } + match.disabled == false && match.startDate != nil && match.endDate == nil } runningMatches.append(contentsOf: matches) } return runningMatches @@ -331,7 +332,7 @@ class DataStore: ObservableObject { var runningMatches: [Match] = [] for tournament in lastTournaments { let matches = tournament.tournamentStore.matches.filter { match in - match.hasEnded() } + match.disabled == false && match.hasEnded() } runningMatches.append(contentsOf: matches) } return runningMatches.sorted(by: \.endDate!, order: .descending)