ajout de la visibilité des joueurs qui n'ont pas de moyen d'être contacté

multistore
Razmig Sarkissian 1 year ago
parent ea0159e3df
commit 44f353e24d
  1. 8
      PadelClub.xcodeproj/project.pbxproj
  2. 6
      PadelClub/Extensions/String+Extensions.swift
  3. 10
      PadelClub/Utils/FileImportManager.swift
  4. 55
      PadelClub/Views/Calling/Components/PlayersWithoutContactView.swift
  5. 2
      PadelClub/Views/Calling/GroupStageCallingView.swift
  6. 5
      PadelClub/Views/Calling/SeedsCallingView.swift
  7. 2
      PadelClub/Views/Club/ClubsView.swift
  8. 1
      PadelClub/Views/Round/RoundView.swift
  9. 6
      PadelClub/Views/Tournament/FileImportView.swift
  10. 14
      PadelClub/Views/Tournament/Screen/Components/InscriptionInfoView.swift

@ -225,6 +225,7 @@
FFC91AF92BD6A09100B29808 /* FortuneWheelView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFC91AF82BD6A09100B29808 /* FortuneWheelView.swift */; };
FFC91B012BD85C2F00B29808 /* Court.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFC91B002BD85C2F00B29808 /* Court.swift */; };
FFC91B032BD85E2400B29808 /* CourtView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFC91B022BD85E2400B29808 /* CourtView.swift */; };
FFCEDA4C2C2C08EA00F8C0F2 /* PlayersWithoutContactView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFCEDA4B2C2C08EA00F8C0F2 /* PlayersWithoutContactView.swift */; };
FFCFBFFE2BBBE86600B82851 /* Algorithms in Frameworks */ = {isa = PBXBuildFile; productRef = FFCFBFFD2BBBE86600B82851 /* Algorithms */; };
FFCFC00C2BBC3D1E00B82851 /* EditScoreView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFCFC0012BBC39A600B82851 /* EditScoreView.swift */; };
FFCFC00E2BBC3D4600B82851 /* PointSelectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFCFC00D2BBC3D4600B82851 /* PointSelectionView.swift */; };
@ -553,6 +554,7 @@
FFC91AF82BD6A09100B29808 /* FortuneWheelView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FortuneWheelView.swift; sourceTree = "<group>"; };
FFC91B002BD85C2F00B29808 /* Court.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Court.swift; sourceTree = "<group>"; };
FFC91B022BD85E2400B29808 /* CourtView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CourtView.swift; sourceTree = "<group>"; };
FFCEDA4B2C2C08EA00F8C0F2 /* PlayersWithoutContactView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayersWithoutContactView.swift; sourceTree = "<group>"; };
FFCFC0012BBC39A600B82851 /* EditScoreView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditScoreView.swift; sourceTree = "<group>"; };
FFCFC00D2BBC3D4600B82851 /* PointSelectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PointSelectionView.swift; sourceTree = "<group>"; };
FFCFC0112BBC3E1A00B82851 /* PointView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PointView.swift; sourceTree = "<group>"; };
@ -1251,6 +1253,7 @@
isa = PBXGroup;
children = (
FFEF7F4D2BDE69130033D0F0 /* MenuWarningView.swift */,
FFCEDA4B2C2C08EA00F8C0F2 /* PlayersWithoutContactView.swift */,
);
path = Components;
sourceTree = "<group>";
@ -1512,6 +1515,7 @@
FF6EC9042B9479F500EA7F5A /* Sequence+Extensions.swift in Sources */,
FF9267FA2BCE78EC0080F940 /* CashierDetailView.swift in Sources */,
C4A47DB32B86387500ADC637 /* AccountView.swift in Sources */,
FFCEDA4C2C2C08EA00F8C0F2 /* PlayersWithoutContactView.swift in Sources */,
FF1CBC1D2BB53DC10036DAAB /* Calendar+Extensions.swift in Sources */,
FF967CF22BAECC0B00A9A3BD /* TeamScore.swift in Sources */,
FF1162832BCFBE4E000C4809 /* EditablePlayerView.swift in Sources */,
@ -1878,7 +1882,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 71;
CURRENT_PROJECT_VERSION = 72;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\"";
@ -1918,7 +1922,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 71;
CURRENT_PROJECT_VERSION = 72;
DEFINES_MODULE = YES;
DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\"";
DEVELOPMENT_TEAM = BQ3Y44M3Q6;

@ -195,3 +195,9 @@ extension String {
return url
}
}
extension String {
func toInt() -> Int? {
Int(self)
}
}

@ -390,16 +390,18 @@ class FileImportManager {
var teamName: String? = nil
let players = team.map { player in
let data = player.components(separatedBy: separator)
let firstName : String = data[safe: 2]?.trimmed ?? ""
let lastName : String = data[safe: 3]?.trimmed ?? ""
let lastName : String = data[safe: 2]?.trimmed ?? ""
let firstName : String = data[safe: 3]?.trimmed ?? ""
let sex: PlayerRegistration.PlayerSexType = data[safe: 0] == "f" ? PlayerRegistration.PlayerSexType.female : PlayerRegistration.PlayerSexType.male
if data[safe: 1]?.trimmed != nil {
teamName = data[safe: 1]?.trimmed
}
let phoneNumber : String? = data[safe: 4]?.trimmed
let email : String? = data[safe: 5]?.trimmed
//let level : String? = data[safe: 6]?.trimmed
let player = PlayerRegistration(firstName: firstName, lastName: lastName, sex: sex, phoneNumber: phoneNumber, email: email)
let rank : Int? = data[safe: 6]?.trimmed.toInt()
let licenceId : String? = data[safe: 7]?.trimmed
let club : String? = data[safe: 8]?.trimmed
let player = PlayerRegistration(firstName: firstName, lastName: lastName, licenceId: licenceId, rank: rank, sex: sex, clubName: club, phoneNumber: phoneNumber, email: email)
return player
}

@ -0,0 +1,55 @@
//
// PlayersWithoutContactView.swift
// PadelClub
//
// Created by Razmig Sarkissian on 26/06/2024.
//
import SwiftUI
struct PlayersWithoutContactView: View {
@Environment(Tournament.self) var tournament: Tournament
let players: [PlayerRegistration]
var body: some View {
Section {
let withoutEmails = players.filter({ $0.email?.isEmpty == true })
DisclosureGroup {
ForEach(withoutEmails) { player in
NavigationLink {
PlayerDetailView(player: player)
.environment(tournament)
} label: {
ImportedPlayerView(player: player)
}
}
} label: {
LabeledContent {
Text(withoutEmails.count.formatted())
} label: {
Text("Joueurs sans email")
}
}
let withoutPhones = players.filter({ $0.phoneNumber?.isEmpty == true })
DisclosureGroup {
ForEach(withoutPhones) { player in
NavigationLink {
PlayerDetailView(player: player)
.environment(tournament)
} label: {
ImportedPlayerView(player: player)
}
}
} label: {
LabeledContent {
Text(withoutPhones.count.formatted())
} label: {
Text("Joueurs sans téléphone")
}
}
} header: {
Text("Joueurs sans moyen de contact")
}
}
}

@ -14,6 +14,8 @@ struct GroupStageCallingView: View {
var body: some View {
let groupStages = tournament.groupStages()
List {
PlayersWithoutContactView(players: groupStages.flatMap({ $0.unsortedTeams() }).flatMap({ $0.unsortedPlayers() }).sorted(by: \.computedRank))
_sameTimeGroupStageView(groupStages: groupStages)
ForEach(groupStages) { groupStage in

@ -13,7 +13,10 @@ struct SeedsCallingView: View {
var body: some View {
List {
ForEach(tournament.rounds()) { round in
let tournamentRounds = tournament.rounds()
PlayersWithoutContactView(players: tournament.seededTeams().flatMap({ $0.unsortedPlayers() }).sorted(by: \.computedRank))
ForEach(tournamentRounds) { round in
let seeds = round.seeds()
let callSeeds = seeds.filter({ tournament.isStartDateIsDifferentThanCallDate($0) == false })
if seeds.isEmpty == false {

@ -30,7 +30,7 @@ struct ClubsView: View {
#if DEBUG
Section {
RowButtonView("Delete unexisted clubs", action: {
var ids = dataStore.user.clubs
let ids = dataStore.user.clubs
ids.forEach { clubId in
if dataStore.clubs.findById(clubId) == nil {
dataStore.user.clubs.removeAll(where: { $0 == clubId })

@ -69,7 +69,6 @@ struct RoundView: View {
var body: some View {
List {
let displayableMatches = upperRound.round.displayableMatches().sorted(by: \.index)
let loserRounds = upperRound.loserRounds
if displayableMatches.isEmpty {
Section {
ContentUnavailableView("Aucun match dans cette manche", systemImage: "tennisball")

@ -16,6 +16,8 @@ enum FileImportCustomField: Int, Identifiable, CaseIterable {
case teamName
case lastName
case firstName
case phoneNumber
case email
case rank
case licenceId
case clubName
@ -44,6 +46,10 @@ enum FileImportCustomField: Int, Identifiable, CaseIterable {
return "Nom"
case .firstName:
return "Prénom"
case .phoneNumber:
return "Téléphone"
case .email:
return "E-mail"
case .rank:
return "Rang"
case .licenceId:

@ -43,13 +43,13 @@ struct InscriptionInfoView: View {
}
.listRowView(color: .cyan)
LabeledContent {
Text(selectedTeams.filter { $0.confirmed() }.count.formatted())
} label: {
Text("Paires ayant confirmées")
Text("Vous avez noté la confirmation de l'équipe")
}
.listRowView(color: .green)
// LabeledContent {
// Text(selectedTeams.filter { $0.confirmed() }.count.formatted())
// } label: {
// Text("Paires ayant confirmées")
// Text("Vous avez noté la confirmation de l'équipe")
// }
// .listRowView(color: .green)
}
Section {

Loading…
Cancel
Save