fix crash groupStageChunkValue when no groupstage

multistore
Razmig Sarkissian 1 year ago
parent 0435956124
commit 252bde5860
  1. 4
      PadelClub.xcodeproj/project.pbxproj
  2. 5
      PadelClub/Data/MatchScheduler.swift
  3. 2
      PadelClub/Data/Tournament.swift

@ -1908,7 +1908,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 63;
CURRENT_PROJECT_VERSION = 65;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\"";
@ -1949,7 +1949,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 63;
CURRENT_PROJECT_VERSION = 65;
DEFINES_MODULE = YES;
DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\"";
DEVELOPMENT_TEAM = BQ3Y44M3Q6;

@ -677,7 +677,10 @@ class MatchScheduler : ModelObject, Storable {
}
func updateSchedule(tournament: Tournament) -> Bool {
let lastDate = updateGroupStageSchedule(tournament: tournament)
var lastDate = tournament.startDate
if tournament.groupStageCount > 0 {
lastDate = updateGroupStageSchedule(tournament: tournament)
}
return updateBracketSchedule(tournament: tournament, fromRoundId: nil, fromMatchId: nil, startDate: lastDate)
}
}

@ -1762,7 +1762,7 @@ class Tournament : ModelObject, Storable {
}
func getGroupStageChunkValue() -> Int {
if teamsPerGroupStage >= 2 {
if groupStageCount > 0 && teamsPerGroupStage >= 2 {
let result = courtCount / (teamsPerGroupStage / 2)
let remainder = courtCount % (teamsPerGroupStage / 2)
let value = remainder == 0 ? result : result + 1

Loading…
Cancel
Save