From 0f2e8f69bd439a5de5b14f9309cc60df5349472b Mon Sep 17 00:00:00 2001 From: Razmig Sarkissian Date: Mon, 3 Jun 2024 23:56:13 +0200 Subject: [PATCH] - fix save not called when no more seeds and edit mode auto-disabling - fix round and loser round addition not handling seed in upper match --- PadelClub.xcodeproj/project.pbxproj | 4 +-- PadelClub/Data/Match.swift | 4 +++ PadelClub/Views/Round/RoundSettingsView.swift | 28 +++++++++++++++++-- PadelClub/Views/Round/RoundView.swift | 4 +-- 4 files changed, 34 insertions(+), 6 deletions(-) diff --git a/PadelClub.xcodeproj/project.pbxproj b/PadelClub.xcodeproj/project.pbxproj index 2eae591..e21dc63 100644 --- a/PadelClub.xcodeproj/project.pbxproj +++ b/PadelClub.xcodeproj/project.pbxproj @@ -1939,7 +1939,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 36; + CURRENT_PROJECT_VERSION = 37; DEFINES_MODULE = YES; DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\""; DEVELOPMENT_TEAM = BQ3Y44M3Q6; @@ -1977,7 +1977,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 36; + CURRENT_PROJECT_VERSION = 37; DEFINES_MODULE = YES; DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\""; DEVELOPMENT_TEAM = BQ3Y44M3Q6; diff --git a/PadelClub/Data/Match.swift b/PadelClub/Data/Match.swift index 4b4d864..3a743b7 100644 --- a/PadelClub/Data/Match.swift +++ b/PadelClub/Data/Match.swift @@ -355,6 +355,10 @@ class Match: ModelObject, Storable { func followingMatch() -> Match? { guard let nextRoundId = roundObject?.nextRound()?.id else { return nil } + return getFollowingMatch(fromNextRoundId: nextRoundId) + } + + func getFollowingMatch(fromNextRoundId nextRoundId: String) -> Match? { return Store.main.filter(isIncluded: { $0.round == nextRoundId && $0.index == (index - 1) / 2 }).first } diff --git a/PadelClub/Views/Round/RoundSettingsView.swift b/PadelClub/Views/Round/RoundSettingsView.swift index eccbf35..cd1b35f 100644 --- a/PadelClub/Views/Round/RoundSettingsView.swift +++ b/PadelClub/Views/Round/RoundSettingsView.swift @@ -52,8 +52,30 @@ struct RoundSettingsView: View { let round = Round(tournament: tournament.id, index: roundIndex, matchFormat: tournament.matchFormat) let matchCount = RoundRule.numberOfMatches(forRoundIndex: roundIndex) let matchStartIndex = RoundRule.matchIndex(fromRoundIndex: roundIndex) - let matches = (0..