|
|
|
@ -30,6 +30,20 @@ struct PlayerDetailView: View { |
|
|
|
return self.tournament.tournamentStore |
|
|
|
return self.tournament.tournamentStore |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var unranked: Binding<Bool> { |
|
|
|
|
|
|
|
Binding { |
|
|
|
|
|
|
|
player.isUnranked() |
|
|
|
|
|
|
|
} set: { isUnranked in |
|
|
|
|
|
|
|
player.rank = nil |
|
|
|
|
|
|
|
player.setComputedRank(in: tournament) |
|
|
|
|
|
|
|
if let team = player.team() { |
|
|
|
|
|
|
|
team.setWeight(from: team.players(), inTournamentCategory: tournament.category) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
_save() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
init(player: PlayerRegistration) { |
|
|
|
init(player: PlayerRegistration) { |
|
|
|
self.player = player |
|
|
|
self.player = player |
|
|
|
_licenceId = .init(wrappedValue: player.licenceId ?? "") |
|
|
|
_licenceId = .init(wrappedValue: player.licenceId ?? "") |
|
|
|
@ -130,6 +144,11 @@ struct PlayerDetailView: View { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Section { |
|
|
|
Section { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Toggle(isOn: unranked) { |
|
|
|
|
|
|
|
Text("Non classé\(player.sex == .female ? "e" : "")") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
LabeledContent { |
|
|
|
LabeledContent { |
|
|
|
TextField("Rang", value: $player.rank, format: .number) |
|
|
|
TextField("Rang", value: $player.rank, format: .number) |
|
|
|
.keyboardType(.decimalPad) |
|
|
|
.keyboardType(.decimalPad) |
|
|
|
@ -147,7 +166,7 @@ struct PlayerDetailView: View { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let maxMaleUnrankedValue: Int = tournament.maleUnrankedValue ?? 90_415 |
|
|
|
let maxMaleUnrankedValue: Int = tournament.maleUnrankedValue ?? 92_327 |
|
|
|
|
|
|
|
|
|
|
|
if player.isMalePlayer() == false && tournament.tournamentCategory == .men && (player.rank == maxMaleUnrankedValue || player.rank == nil) { |
|
|
|
if player.isMalePlayer() == false && tournament.tournamentCategory == .men && (player.rank == maxMaleUnrankedValue || player.rank == nil) { |
|
|
|
Section { |
|
|
|
Section { |
|
|
|
|