fix next matches display

paca_championship
Raz 12 months ago
parent 41b62a73ae
commit 17e0c85e0b
  1. 8
      PadelClub.xcodeproj/project.pbxproj
  2. 11
      PadelClub/Data/DataStore.swift

@ -3254,7 +3254,7 @@
CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements; CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 3; CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\""; DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\"";
@ -3278,7 +3278,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.30; MARKETING_VERSION = 1.0.31;
PRODUCT_BUNDLE_IDENTIFIER = app.padelclub; PRODUCT_BUNDLE_IDENTIFIER = app.padelclub;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
@ -3299,7 +3299,7 @@
CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements; CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 3; CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\""; DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\"";
DEVELOPMENT_TEAM = BQ3Y44M3Q6; DEVELOPMENT_TEAM = BQ3Y44M3Q6;
@ -3322,7 +3322,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.30; MARKETING_VERSION = 1.0.31;
PRODUCT_BUNDLE_IDENTIFIER = app.padelclub; PRODUCT_BUNDLE_IDENTIFIER = app.padelclub;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";

@ -299,12 +299,13 @@ class DataStore: ObservableObject {
func runningMatches() -> [Match] { func runningMatches() -> [Match] {
let dateNow : Date = Date() 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] = [] var runningMatches: [Match] = []
for tournament in lastTournaments { for tournament in lastTournaments {
let matches = tournament.tournamentStore.matches.filter { match in let matches = tournament.tournamentStore.matches.filter { match in
match.isRunning() } match.disabled == false && match.isRunning()
}
runningMatches.append(contentsOf: matches) runningMatches.append(contentsOf: matches)
} }
return runningMatches return runningMatches
@ -313,12 +314,12 @@ class DataStore: ObservableObject {
func runningAndNextMatches() -> [Match] { func runningAndNextMatches() -> [Match] {
let dateNow : Date = Date() 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] = [] var runningMatches: [Match] = []
for tournament in lastTournaments { for tournament in lastTournaments {
let matches = tournament.tournamentStore.matches.filter { match in 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) runningMatches.append(contentsOf: matches)
} }
return runningMatches return runningMatches
@ -331,7 +332,7 @@ class DataStore: ObservableObject {
var runningMatches: [Match] = [] var runningMatches: [Match] = []
for tournament in lastTournaments { for tournament in lastTournaments {
let matches = tournament.tournamentStore.matches.filter { match in let matches = tournament.tournamentStore.matches.filter { match in
match.hasEnded() } match.disabled == false && match.hasEnded() }
runningMatches.append(contentsOf: matches) runningMatches.append(contentsOf: matches)
} }
return runningMatches.sorted(by: \.endDate!, order: .descending) return runningMatches.sorted(by: \.endDate!, order: .descending)

Loading…
Cancel
Save