diff --git a/PadelClub/Data/TeamRegistration.swift b/PadelClub/Data/TeamRegistration.swift index 606e32c..824870d 100644 --- a/PadelClub/Data/TeamRegistration.swift +++ b/PadelClub/Data/TeamRegistration.swift @@ -200,13 +200,13 @@ class TeamRegistration: ModelObject, Storable { return ids.hashValue == searchedIds.hashValue } - func includes(_ players: [PlayerRegistration]) -> Bool { + func includes(players: [PlayerRegistration]) -> Bool { return players.allSatisfy { player in - includes(player) + includes(player: player) } } - func includes(_ player: PlayerRegistration) -> Bool { + func includes(player: PlayerRegistration) -> Bool { return unsortedPlayers().anySatisfy { _player in _player.isSameAs(player) } diff --git a/PadelClub/Data/Tournament.swift b/PadelClub/Data/Tournament.swift index 853a339..409f071 100644 --- a/PadelClub/Data/Tournament.swift +++ b/PadelClub/Data/Tournament.swift @@ -1195,7 +1195,7 @@ class Tournament : ModelObject, Storable { } func findTeam(_ players: [PlayerRegistration]) -> TeamRegistration? { - return unsortedTeams().first(where: { $0.includes(players) }) + return unsortedTeams().first(where: { $0.includes(players: players) }) } func tournamentTitle(_ displayStyle: DisplayStyle = .wide) -> String { diff --git a/PadelClub/Views/Shared/ImportedPlayerView.swift b/PadelClub/Views/Shared/ImportedPlayerView.swift index a254fc0..d16fdef 100644 --- a/PadelClub/Views/Shared/ImportedPlayerView.swift +++ b/PadelClub/Views/Shared/ImportedPlayerView.swift @@ -72,8 +72,8 @@ struct ImportedPlayerView: View { Text("messieurs") } .font(.caption) + Text(")").font(.title3) } - Text(")").font(.title3) } HStack { diff --git a/PadelClub/Views/Tournament/Screen/InscriptionManagerView.swift b/PadelClub/Views/Tournament/Screen/InscriptionManagerView.swift index 65935cd..16d463b 100644 --- a/PadelClub/Views/Tournament/Screen/InscriptionManagerView.swift +++ b/PadelClub/Views/Tournament/Screen/InscriptionManagerView.swift @@ -961,7 +961,7 @@ struct InscriptionManagerView: View { ForEach(createdPlayerIds.sorted(), id: \.self) { id in if let p = createdPlayers.first(where: { $0.id == id }) { VStack(alignment: .leading, spacing: 0) { - if unsortedPlayers.first(where: { $0.licenceId == p.licenceId }) != nil { + if let player = unsortedPlayers.first(where: { $0.licenceId == p.licenceId }), editedTeam?.includes(player: player) == false { Text("Déjà inscrit !").foregroundStyle(.logoRed).bold() } PlayerView(player: p).tag(p.id)