small fixes

multistore
Razmig Sarkissian 2 years ago
parent a88e04f25b
commit cb89a322ca
  1. 4
      PadelClub/Views/Player/Components/PlayerSexPickerView.swift
  2. 2
      PadelClub/Views/Tournament/FileImportView.swift
  3. 61
      PadelClub/Views/Tournament/Screen/Components/InscriptionInfoView.swift
  4. 1
      PadelClub/Views/Tournament/Screen/InscriptionManagerView.swift

@ -17,8 +17,8 @@ struct PlayerSexPickerView: View {
Text(player.playerLabel())
Spacer()
Picker(selection: $player.sex) {
Text("Homme").tag(1 as Int64)
Text("Femme").tag(0 as Int64)
Text("Homme").tag(1 as Int)
Text("Femme").tag(0 as Int)
} label: {
}

@ -180,6 +180,7 @@ struct FileImportView: View {
if let selectedFile = fileurls.first {
if selectedFile.startAccessingSecurityScopedResource() {
convertingFile = true
errorMessage = nil
teams.removeAll()
Task {
do {
@ -262,6 +263,7 @@ struct FileImportView: View {
func _startImport(fileContent: String) async {
await MainActor.run {
convertingFile = true
errorMessage = nil
teams.removeAll()
}
self.teams = await FileImportManager.shared.createTeams(from: fileContent, tournament: tournament, fileProvider: fileProvider)

@ -8,18 +8,45 @@
import SwiftUI
struct InscriptionInfoView: View {
@EnvironmentObject var dataStore: DataStore
@Environment(Tournament.self) var tournament
@State private var duplicates = [PlayerRegistration]()
@State private var problematicPlayers = [PlayerRegistration]()
@State private var inadequatePlayers = [PlayerRegistration]()
@State private var playersWithoutValidLicense = [PlayerRegistration]()
@State private var entriesNotFromBeachPadel = [TeamRegistration]()
@State private var entriesFromBeachPadel = [TeamRegistration]()
@State private var playersMissing = [TeamRegistration]()
@State private var waitingList = [TeamRegistration]()
@State private var selectedTeams = [TeamRegistration]()
var body: some View {
List {
Section {
LabeledContent {
Text(entriesFromBeachPadel.count.formatted())
} label: {
Text("Paires importées")
Text(SourceFileManager.beachPadel.absoluteString)
}
.listRowView(color: .indigo)
LabeledContent {
Text(selectedTeams.filter { $0.called() }.count.formatted())
} label: {
Text("Paires convoquées")
Text("Vous avez envoyé une convocation par sms ou email")
}
.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)
}
let waitingListInBracket = waitingList.filter({ $0.bracketPosition != nil })
let waitingListInGroupStage = waitingList.filter({ $0.groupStage != nil })
@ -96,9 +123,7 @@ struct InscriptionInfoView: View {
LabeledContent {
Text(inadequatePlayers.count.formatted())
} label: {
let playerLabel : String = tournament.tournamentCategory == .women ? "joueuse" : "joueur"
let grammarSuffix : String = tournament.tournamentCategory == .women ? "e" + inadequatePlayers.count.pluralSuffix : inadequatePlayers.count.pluralSuffix
Text(playerLabel.capitalized + inadequatePlayers.count.pluralSuffix + " trop bien classé" + grammarSuffix)
Text("Joueurs trop bien classés")
}
}
.listRowView(color: .red)
@ -137,32 +162,6 @@ struct InscriptionInfoView: View {
}
.listRowView(color: .pink)
}
Section {
LabeledContent {
Text(entriesNotFromBeachPadel.count.formatted())
} label: {
Text("Paires importées")
Text(SourceFileManager.beachPadel.absoluteString)
}
.listRowView(color: .indigo)
LabeledContent {
Text(selectedTeams.filter { $0.called() }.count.formatted())
} label: {
Text("Paires convoquées")
Text("Vous avez envoyé une convocation par sms ou email")
}
.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)
}
}
.navigationTitle("Synthèse")
.navigationBarTitleDisplayMode(.inline)
@ -180,7 +179,7 @@ struct InscriptionInfoView: View {
problematicPlayers = players.filter({ $0.sex == -1 })
inadequatePlayers = tournament.inadequatePlayers(in: players)
playersWithoutValidLicense = tournament.playersWithoutValidLicense(in: players)
entriesNotFromBeachPadel = selectedTeams.filter({ $0.isImported() })
entriesFromBeachPadel = tournament.unsortedTeams().filter({ $0.isImported() })
playersMissing = selectedTeams.filter({ $0.unsortedPlayers().count < 2 })
}
}

@ -123,6 +123,7 @@ struct InscriptionManagerView: View {
ToolbarItem(placement: .cancellationAction) {
Button("Annuler", role: .cancel) {
pasteString = nil
editedTeam = nil
createdPlayers.removeAll()
createdPlayerIds.removeAll()
}

Loading…
Cancel
Save