multistore
Razmig Sarkissian 1 year ago
parent ec116617fc
commit 28fe27d8d6
  1. 6
      PadelClub/Data/TeamRegistration.swift
  2. 2
      PadelClub/Data/Tournament.swift
  3. 2
      PadelClub/Views/Shared/ImportedPlayerView.swift
  4. 2
      PadelClub/Views/Tournament/Screen/InscriptionManagerView.swift

@ -200,13 +200,13 @@ class TeamRegistration: ModelObject, Storable {
return ids.hashValue == searchedIds.hashValue return ids.hashValue == searchedIds.hashValue
} }
func includes(_ players: [PlayerRegistration]) -> Bool { func includes(players: [PlayerRegistration]) -> Bool {
return players.allSatisfy { player in 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 return unsortedPlayers().anySatisfy { _player in
_player.isSameAs(player) _player.isSameAs(player)
} }

@ -1195,7 +1195,7 @@ class Tournament : ModelObject, Storable {
} }
func findTeam(_ players: [PlayerRegistration]) -> TeamRegistration? { 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 { func tournamentTitle(_ displayStyle: DisplayStyle = .wide) -> String {

@ -72,9 +72,9 @@ struct ImportedPlayerView: View {
Text("messieurs") Text("messieurs")
} }
.font(.caption) .font(.caption)
}
Text(")").font(.title3) Text(")").font(.title3)
} }
}
HStack { HStack {
Text(player.formattedLicense()) Text(player.formattedLicense())

@ -961,7 +961,7 @@ struct InscriptionManagerView: View {
ForEach(createdPlayerIds.sorted(), id: \.self) { id in ForEach(createdPlayerIds.sorted(), id: \.self) { id in
if let p = createdPlayers.first(where: { $0.id == id }) { if let p = createdPlayers.first(where: { $0.id == id }) {
VStack(alignment: .leading, spacing: 0) { 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() Text("Déjà inscrit !").foregroundStyle(.logoRed).bold()
} }
PlayerView(player: p).tag(p.id) PlayerView(player: p).tag(p.id)

Loading…
Cancel
Save