fix issue with structure reset
main
Razmig Sarkissian 2 weeks ago
parent 57945f6cfd
commit 00d759dd6c
  1. 4
      PadelClub.xcodeproj/project.pbxproj
  2. 1
      PadelClub/Views/Components/FortuneWheelView.swift
  3. 6
      PadelClub/Views/Score/SetInputView.swift
  4. 12
      PadelClub/Views/Tournament/Screen/TableStructureView.swift

@ -3245,7 +3245,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 = 4;
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\"";
@ -3293,7 +3293,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 = 4;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\""; DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\"";
DEVELOPMENT_TEAM = BQ3Y44M3Q6; DEVELOPMENT_TEAM = BQ3Y44M3Q6;

@ -157,6 +157,7 @@ struct SpinDrawView: View {
ToolbarItem(placement: .status) { ToolbarItem(placement: .status) {
Text("Tous les tirages sont terminés") Text("Tous les tirages sont terminés")
.frame(maxWidth: .infinity)
} }
} }
} }

@ -234,7 +234,11 @@ struct SetInputView: View {
} else if newValue == setFormat.scoreToWin - 2 && setFormat.tieBreak == 8 { } else if newValue == setFormat.scoreToWin - 2 && setFormat.tieBreak == 8 {
otherTeamValueBinding.wrappedValue = setFormat.scoreToWin otherTeamValueBinding.wrappedValue = setFormat.scoreToWin
} else if newValue == setFormat.scoreToWin - 1 { } else if newValue == setFormat.scoreToWin - 1 {
otherTeamValueBinding.wrappedValue = setFormat.scoreToWin + 1 if setFormat == .three {
otherTeamValueBinding.wrappedValue = setFormat.scoreToWin
} else {
otherTeamValueBinding.wrappedValue = setFormat.scoreToWin + 1
}
} else if newValue <= setFormat.scoreToWin - 2 { } else if newValue <= setFormat.scoreToWin - 2 {
otherTeamValueBinding.wrappedValue = setFormat.scoreToWin otherTeamValueBinding.wrappedValue = setFormat.scoreToWin
} else if newValue > 10 && setFormat == .superTieBreak { } else if newValue > 10 && setFormat == .superTieBreak {

@ -124,7 +124,7 @@ struct TableStructureView: View {
Section { Section {
LabeledContent { LabeledContent {
StepperView(count: $teamCount, minimum: 4, maximum: 128) { StepperView(count: $teamCount, minimum: 2, maximum: 128) {
} submitFollowUpAction: { } submitFollowUpAction: {
_verifyValueIntegrity() _verifyValueIntegrity()
@ -536,6 +536,7 @@ struct TableStructureView: View {
} }
private func _reset() { private func _reset() {
let tc = tournament.teamCount
tournament.unsortedTeams().forEach { tournament.unsortedTeams().forEach {
$0.resetPositions() $0.resetPositions()
} }
@ -549,7 +550,8 @@ struct TableStructureView: View {
_updatePreset() _updatePreset()
} }
tournament.teamCount = teamCount teamCount = tc
tournament.teamCount = tc
tournament.groupStageCount = groupStageCount tournament.groupStageCount = groupStageCount
tournament.teamsPerGroupStage = teamsPerGroupStage tournament.teamsPerGroupStage = teamsPerGroupStage
tournament.qualifiedPerGroupStage = qualifiedPerGroupStage tournament.qualifiedPerGroupStage = qualifiedPerGroupStage
@ -598,7 +600,7 @@ struct TableStructureView: View {
private func _save(rebuildEverything: Bool = false) async { private func _save(rebuildEverything: Bool = false) async {
_verifyValueIntegrity() _verifyValueIntegrity()
let tc = tournament.teamCount
do { do {
let requirements = Set(updatedElements.compactMap { $0.requiresRebuilding }) let requirements = Set(updatedElements.compactMap { $0.requiresRebuilding })
@ -774,8 +776,8 @@ struct TableStructureView: View {
groupStageCount = maxGroupStages groupStageCount = maxGroupStages
} }
if teamCount < 4 { if teamCount < 2 {
teamCount = 4 teamCount = 2
} }
if groupStageCount < 0 { if groupStageCount < 0 {

Loading…
Cancel
Save