club_update
Razmig Sarkissian 1 year ago
parent 3ced902613
commit 9f32bf3dbd
  1. 4
      PadelClub.xcodeproj/project.pbxproj
  2. 6
      PadelClub/Assets.xcassets/logoRed.colorset/Contents.json
  3. 6
      PadelClub/Data/Round.swift
  4. 24
      PadelClub/Data/Tournament.swift
  5. 2
      PadelClub/Utils/PadelRule.swift
  6. 2
      PadelClub/ViewModel/Selectable.swift
  7. 2
      PadelClub/Views/Components/FortuneWheelView.swift
  8. 4
      PadelClub/Views/Components/GenericDestinationPickerView.swift
  9. 2
      PadelClub/Views/Components/RowButtonView.swift
  10. 2
      PadelClub/Views/Match/Components/MatchTeamDetailView.swift
  11. 2
      PadelClub/Views/Navigation/Umpire/UmpireView.swift
  12. 2
      PadelClub/Views/Planning/CourtAvailabilitySettingsView.swift
  13. 3
      PadelClub/Views/Team/Components/TeamHeaderView.swift
  14. 2
      PadelClub/Views/Team/TeamRowView.swift
  15. 2
      PadelClub/Views/Tournament/FileImportView.swift
  16. 8
      PadelClub/Views/Tournament/Screen/Components/InscriptionInfoView.swift
  17. 20
      PadelClub/Views/Tournament/Screen/InscriptionManagerView.swift
  18. 2
      PadelClub/Views/Tournament/Screen/TournamentRankView.swift
  19. 4
      PadelClub/Views/Tournament/TournamentBuildView.swift
  20. 2
      PadelClub/Views/User/ChangePasswordView.swift
  21. 2
      PadelClub/Views/User/LoginView.swift

@ -1906,7 +1906,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements; CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 88; CURRENT_PROJECT_VERSION = 89;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\""; DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\"";
@ -1950,7 +1950,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements; CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 88; CURRENT_PROJECT_VERSION = 89;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\""; DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\"";
DEVELOPMENT_TEAM = BQ3Y44M3Q6; DEVELOPMENT_TEAM = BQ3Y44M3Q6;

@ -23,9 +23,9 @@
"color-space" : "srgb", "color-space" : "srgb",
"components" : { "components" : {
"alpha" : "1.000", "alpha" : "1.000",
"blue" : "1.000", "blue" : "0.220",
"green" : "1.000", "green" : "0.251",
"red" : "1.000" "red" : "0.910"
} }
}, },
"idiom" : "universal" "idiom" : "universal"

@ -556,7 +556,11 @@ defer {
let currentRoundMatchCount = RoundRule.numberOfMatches(forRoundIndex: index) let currentRoundMatchCount = RoundRule.numberOfMatches(forRoundIndex: index)
guard currentRoundMatchCount > 1 else { return } guard currentRoundMatchCount > 1 else { return }
let roundCount = RoundRule.numberOfRounds(forTeams: currentRoundMatchCount) let roundCount = RoundRule.numberOfRounds(forTeams: currentRoundMatchCount)
let loserBracketMatchFormat = tournamentObject()?.loserBracketMatchFormat
var loserBracketMatchFormat = tournamentObject()?.loserBracketMatchFormat
if let parentRound {
loserBracketMatchFormat = tournamentObject()?.loserBracketSmartMatchFormat(parentRound.index)
}
let rounds = (0..<roundCount).map { //index 0 is the final let rounds = (0..<roundCount).map { //index 0 is the final
let round = Round(tournament: tournament, index: $0, matchFormat: loserBracketMatchFormat) let round = Round(tournament: tournament, index: $0, matchFormat: loserBracketMatchFormat)

@ -807,6 +807,12 @@ defer {
return teams + waitingListTeams(in: teams) return teams + waitingListTeams(in: teams)
} }
func waitingListSortedTeams() -> [TeamRegistration] {
let teams = selectedSortedTeams()
return waitingListTeams(in: teams)
}
func selectedSortedTeams() -> [TeamRegistration] { func selectedSortedTeams() -> [TeamRegistration] {
#if DEBUG_TIME //DEBUGING TIME #if DEBUG_TIME //DEBUGING TIME
let start = Date() let start = Date()
@ -875,7 +881,7 @@ defer {
return waitingList.filter { $0.walkOut == false }.sorted(using: _defaultSorting(), order: .ascending) + waitingList.filter { $0.walkOut == true }.sorted(using: _defaultSorting(), order: .ascending) return waitingList.filter { $0.walkOut == false }.sorted(using: _defaultSorting(), order: .ascending) + waitingList.filter { $0.walkOut == true }.sorted(using: _defaultSorting(), order: .ascending)
} }
func bracketCut() -> Int { func bracketCut(teamCount: Int) -> Int {
return max(0, teamCount - groupStageCut()) return max(0, teamCount - groupStageCut())
} }
@ -883,10 +889,12 @@ defer {
return groupStageSpots() return groupStageSpots()
} }
func cutLabel(index: Int) -> String { func cutLabel(index: Int, teamCount: Int?) -> String {
if index < bracketCut() { let _teamCount = teamCount ?? selectedSortedTeams().count
let bracketCut = bracketCut(teamCount: _teamCount)
if index < bracketCut {
return "Tableau" return "Tableau"
} else if index - bracketCut() < groupStageCut() { } else if index - bracketCut < groupStageCut() && _teamCount > 0 {
return "Poule" return "Poule"
} else { } else {
return "Attente" return "Attente"
@ -1543,7 +1551,7 @@ defer {
var _groupStages = [GroupStage]() var _groupStages = [GroupStage]()
for index in 0..<groupStageCount { for index in 0..<groupStageCount {
let groupStage = GroupStage(tournament: id, index: index, size: teamsPerGroupStage, matchFormat: groupStageMatchFormat) let groupStage = GroupStage(tournament: id, index: index, size: teamsPerGroupStage, matchFormat: groupStageSmartMatchFormat())
_groupStages.append(groupStage) _groupStages.append(groupStage)
} }
@ -1566,7 +1574,7 @@ defer {
let roundCount = RoundRule.numberOfRounds(forTeams: bracketTeamCount()) let roundCount = RoundRule.numberOfRounds(forTeams: bracketTeamCount())
let rounds = (0..<roundCount).map { //index 0 is the final let rounds = (0..<roundCount).map { //index 0 is the final
Round(tournament: id, index: $0) return Round(tournament: id, index: $0, matchFormat: roundSmartMatchFormat($0))
} }
do { do {
@ -1579,7 +1587,7 @@ defer {
let matches = (0..<matchCount).map { //0 is final match let matches = (0..<matchCount).map { //0 is final match
let roundIndex = RoundRule.roundIndex(fromMatchIndex: $0) let roundIndex = RoundRule.roundIndex(fromMatchIndex: $0)
let round = rounds[roundIndex] let round = rounds[roundIndex]
return Match(round: round.id, index: $0, matchFormat: matchFormat, name: Match.setServerTitle(upperRound: round, matchIndex: RoundRule.matchIndexWithinRound(fromMatchIndex: $0))) return Match(round: round.id, index: $0, matchFormat: round.matchFormat, name: Match.setServerTitle(upperRound: round, matchIndex: RoundRule.matchIndexWithinRound(fromMatchIndex: $0)))
} }
print(matches.map { print(matches.map {
@ -1783,7 +1791,7 @@ defer {
teamSorting = newValue.defaultTeamSortingType teamSorting = newValue.defaultTeamSortingType
groupStageMatchFormat = groupStageSmartMatchFormat() groupStageMatchFormat = groupStageSmartMatchFormat()
loserBracketMatchFormat = loserBracketSmartMatchFormat(1) loserBracketMatchFormat = loserBracketSmartMatchFormat(1)
matchFormat = roundSmartMatchFormat(1) matchFormat = roundSmartMatchFormat(5)
} }
} }

@ -329,7 +329,7 @@ enum TournamentLevel: Int, Hashable, Codable, CaseIterable, Identifiable {
case .p500: case .p500:
if roundIndex == 0 { //finale if roundIndex == 0 { //finale
return .twoSetsDecisivePoint return .twoSetsDecisivePointSuperTie
} else if roundIndex == 1 { //demi-finale } else if roundIndex == 1 { //demi-finale
return .twoSetsDecisivePointSuperTie return .twoSetsDecisivePointSuperTie
} else { } else {

@ -43,7 +43,7 @@ enum Badge {
case .checkmark: case .checkmark:
.green .green
case .xmark: case .xmark:
.red .logoRed
case .custom(_, let color): case .custom(_, let color):
color color
} }

@ -239,7 +239,7 @@ struct FortuneWheelContainerView: View {
.padding(.top, 5) .padding(.top, 5)
.overlay(alignment: .top) { .overlay(alignment: .top) {
Triangle() Triangle()
.fill(Color.red) .fill(Color.logoRed)
.stroke(Color.black, lineWidth: 2) .stroke(Color.black, lineWidth: 2)
.frame(width: 20, height: 20) .frame(width: 20, height: 20)
.rotationEffect(.degrees(180)) .rotationEffect(.degrees(180))

@ -62,7 +62,7 @@ struct GenericDestinationPickerView<T: Identifiable & Selectable & Equatable >:
.offset(x: 3, y: 3) .offset(x: 3, y: 3)
} else if let count, count > 0 { } else if let count, count > 0 {
Image(systemName: count <= 50 ? "\(String(count)).circle.fill" : "plus.circle.fill") Image(systemName: count <= 50 ? "\(String(count)).circle.fill" : "plus.circle.fill")
.foregroundColor(destination.badgeValueColor() ?? .red) .foregroundColor(destination.badgeValueColor() ?? .logoRed)
.imageScale(.medium) .imageScale(.medium)
.background ( .background (
Color(.systemBackground) Color(.systemBackground)
@ -82,7 +82,7 @@ struct GenericDestinationPickerView<T: Identifiable & Selectable & Equatable >:
.offset(x: 3, y: 3) .offset(x: 3, y: 3)
} else if let count = destination.badgeValue(), count > 0 { } else if let count = destination.badgeValue(), count > 0 {
Image(systemName: count <= 50 ? "\(String(count)).circle.fill" : "plus.circle.fill") Image(systemName: count <= 50 ? "\(String(count)).circle.fill" : "plus.circle.fill")
.foregroundColor(destination.badgeValueColor() ?? .red) .foregroundColor(destination.badgeValueColor() ?? .logoRed)
.imageScale(.medium) .imageScale(.medium)
.background ( .background (
Color(.systemBackground) Color(.systemBackground)

@ -87,7 +87,7 @@ struct RowButtonView: View {
.disabled(isLoading) .disabled(isLoading)
.frame(maxWidth: .infinity) .frame(maxWidth: .infinity)
.buttonStyle(.borderedProminent) .buttonStyle(.borderedProminent)
.tint(role == .destructive ? Color.red : Color.master) .tint(role == .destructive ? Color.logoRed : Color.master)
.listRowBackground(Color.clear) .listRowBackground(Color.clear)
.listRowInsets(EdgeInsets(.zero)) .listRowInsets(EdgeInsets(.zero))
.confirmationDialog("Confirmation", .confirmationDialog("Confirmation",

@ -34,7 +34,7 @@ struct MatchTeamDetailView: View {
EditablePlayerView(player: player, editingOptions: [.licenceId, .name, .payment]) EditablePlayerView(player: player, editingOptions: [.licenceId, .name, .payment])
} }
} header: { } header: {
TeamHeaderView(team: team, teamIndex: tournament?.indexOf(team: team), tournament: nil) TeamHeaderView(team: team, teamIndex: tournament?.indexOf(team: team))
} }
} }

@ -134,7 +134,7 @@ struct UmpireView: View {
} else { } else {
LabeledContent { LabeledContent {
Image(systemName: "xmark.circle.fill") Image(systemName: "xmark.circle.fill")
.tint(.red) .tint(.logoRed)
} label: { } label: {
if let _mostRecentDateAvailable { if let _mostRecentDateAvailable {
Text(_mostRecentDateAvailable.monthYearFormatted) Text(_mostRecentDateAvailable.monthYearFormatted)

@ -67,7 +67,7 @@ struct CourtAvailabilitySettingsView: View {
VStack { VStack {
Image(systemName: "arrowshape.forward.fill") Image(systemName: "arrowshape.forward.fill")
.tint(.master) .tint(.master)
Text("indisponible").foregroundStyle(.red).font(.caption) Text("indisponible").foregroundStyle(.logoRed).font(.caption)
} }
Spacer() Spacer()
VStack(alignment: .trailing, spacing: 0) { VStack(alignment: .trailing, spacing: 0) {

@ -11,6 +11,7 @@ struct TeamHeaderView: View {
var team: TeamRegistration var team: TeamRegistration
var teamIndex: Int? var teamIndex: Int?
var tournament: Tournament? var tournament: Tournament?
var teamCount: Int?
var body: some View { var body: some View {
HStack(spacing: 16.0) { HStack(spacing: 16.0) {
@ -46,7 +47,7 @@ struct TeamHeaderView: View {
} else { } else {
Text("").font(.caption) Text("").font(.caption)
} }
Text(tournament.cutLabel(index: teamIndex)) Text(tournament.cutLabel(index: teamIndex, teamCount: teamCount))
} }
} }
} }

@ -26,7 +26,7 @@ struct TeamRowView: View {
} }
if let callDate = team.callDate, displayCallDate { if let callDate = team.callDate, displayCallDate {
Text("Déjà convoquée \(callDate.localizedDate())") Text("Déjà convoquée \(callDate.localizedDate())")
.foregroundStyle(.red) .foregroundStyle(.logoRed)
.italic() .italic()
.font(.caption) .font(.caption)
} }

@ -492,7 +492,7 @@ struct FileImportView: View {
} }
if let callDate = team.previousTeam?.callDate, let newDate = tournament.getStartDate(ofSeedIndex: newIndex), callDate != newDate { if let callDate = team.previousTeam?.callDate, let newDate = tournament.getStartDate(ofSeedIndex: newIndex), callDate != newDate {
Text("Attention, cette paire a déjà été convoquée à \(callDate.localizedDate())") Text("Attention, cette paire a déjà été convoquée à \(callDate.localizedDate())")
.foregroundStyle(.red) .foregroundStyle(.logoRed)
.italic() .italic()
.font(.caption) .font(.caption)
} }

@ -91,7 +91,7 @@ struct InscriptionInfoView: View {
Text("Dans le tableau") Text("Dans le tableau")
} }
} }
.listRowView(color: .red) .listRowView(color: .logoRed)
DisclosureGroup { DisclosureGroup {
ForEach(waitingListInGroupStage) { team in ForEach(waitingListInGroupStage) { team in
@ -104,7 +104,7 @@ struct InscriptionInfoView: View {
Text("En poule") Text("En poule")
} }
} }
.listRowView(color: .red) .listRowView(color: .logoRed)
} header: { } header: {
Text("Équipes ne devant plus être sélectionnées") Text("Équipes ne devant plus être sélectionnées")
} footer: { } footer: {
@ -123,7 +123,7 @@ struct InscriptionInfoView: View {
Text("Doublons") Text("Doublons")
} }
} }
.listRowView(color: .red) .listRowView(color: .logoRed)
} }
Section { Section {
@ -155,7 +155,7 @@ struct InscriptionInfoView: View {
Text("Joueurs trop bien classés") Text("Joueurs trop bien classés")
} }
} }
.listRowView(color: .red) .listRowView(color: .logoRed)
} footer: { } footer: {
Text("Il s'agit des joueurs ou joueuses dont le rang est inférieur à la limite fédérale.") Text("Il s'agit des joueurs ou joueuses dont le rang est inférieur à la limite fédérale.")
} }

@ -98,6 +98,7 @@ struct InscriptionManagerView: View {
var id: Int { self.rawValue } var id: Int { self.rawValue }
case all case all
case walkOut case walkOut
case waiting
func localizedLabel() -> String { func localizedLabel() -> String {
switch self { switch self {
@ -105,6 +106,8 @@ struct InscriptionManagerView: View {
return "Toutes les équipes" return "Toutes les équipes"
case .walkOut: case .walkOut:
return "Voir les WOs" return "Voir les WOs"
case .waiting:
return "Liste d'attente"
} }
} }
} }
@ -468,7 +471,11 @@ struct InscriptionManagerView: View {
print("func _prepareTeams", duration.formatted(.units(allowed: [.seconds, .milliseconds]))) print("func _prepareTeams", duration.formatted(.units(allowed: [.seconds, .milliseconds])))
} }
#endif #endif
sortedTeams = tournament.sortedTeams() if filterMode == .waiting {
sortedTeams = tournament.waitingListSortedTeams()
} else {
sortedTeams = tournament.sortedTeams()
}
} }
var filteredTeams: [TeamRegistration] { var filteredTeams: [TeamRegistration] {
@ -511,12 +518,19 @@ struct InscriptionManagerView: View {
private func _teamRegisteredView() -> some View { private func _teamRegisteredView() -> some View {
List { List {
let selectedSortedTeams = tournament.selectedSortedTeams()
if let closedRegistrationDate = tournament.closedRegistrationDate { if let closedRegistrationDate = tournament.closedRegistrationDate {
Section { Section {
CloseDatePicker(closedRegistrationDate: closedRegistrationDate) CloseDatePicker(closedRegistrationDate: closedRegistrationDate)
} footer: { } footer: {
Text("Toutes les équipes ayant été inscrites après la date de clôture seront en liste d'attente.") Text("Toutes les équipes ayant été inscrites après la date de clôture seront en liste d'attente.")
} }
if selectedSortedTeams.isEmpty {
Section {
ContentUnavailableView("Aucune équipe", systemImage: "person.2.slash", description: Text("Vous n'avez aucune équipe inscrite avant la date de clôture."))
}
}
} }
if presentSearch == false { if presentSearch == false {
@ -560,7 +574,7 @@ struct InscriptionManagerView: View {
Section { Section {
TeamDetailView(team: team) TeamDetailView(team: team)
} header: { } header: {
TeamHeaderView(team: team, teamIndex: teamIndex, tournament: tournament) TeamHeaderView(team: team, teamIndex: teamIndex, tournament: tournament, teamCount: filterMode == .waiting ? 0 : selectedSortedTeams.count)
} footer: { } footer: {
_teamFooterView(team) _teamFooterView(team)
} }
@ -722,7 +736,7 @@ struct InscriptionManagerView: View {
} }
Section { Section {
ContentUnavailableView("Aucune équipe", systemImage: "person.2.slash", description: Text("Vous n'avez encore aucune équipe dans votre liste d'attente.")) ContentUnavailableView("Aucune équipe", systemImage: "person.2.slash", description: Text("Vous n'avez encore aucune équipe inscrite dans votre tournoi."))
} }
_rankHandlerView() _rankHandlerView()

@ -213,7 +213,7 @@ struct TournamentRankView: View {
Image(systemName: "arrowtriangle.down.fill") Image(systemName: "arrowtriangle.down.fill")
.imageScale(.small) .imageScale(.small)
} }
.foregroundColor(.red) .foregroundColor(.logoRed)
} else { } else {
Text("--") Text("--")
} }

@ -102,7 +102,7 @@ struct TournamentBuildView: View {
} label: { } label: {
Text("Classement final des équipes") Text("Classement final des équipes")
if tournament.publishRankings == false { if tournament.publishRankings == false {
Text("Vérifiez le classement avant de publier").foregroundStyle(.red) Text("Vérifiez le classement avant de publier").foregroundStyle(.logoRed)
} }
} }
} }
@ -120,7 +120,7 @@ struct TournamentBuildView: View {
} label: { } label: {
Text("Classement final des équipes") Text("Classement final des équipes")
if tournament.publishRankings == false { if tournament.publishRankings == false {
Text("Vérifiez le classement avant de publier").foregroundStyle(.red) Text("Vérifiez le classement avant de publier").foregroundStyle(.logoRed)
} }
} }
} }

@ -46,7 +46,7 @@ struct ChangePasswordView: View {
.frame(maxWidth: .infinity) .frame(maxWidth: .infinity)
} footer: { } footer: {
if self.errorMessage.count > 0 { if self.errorMessage.count > 0 {
Text(self.errorMessage).foregroundStyle(.red) Text(self.errorMessage).foregroundStyle(.logoRed)
} }
} }
} }

@ -131,7 +131,7 @@ struct LoginView: View {
} }
.disabled(password.isEmpty || username.isEmpty) .disabled(password.isEmpty || username.isEmpty)
// if let error = self.errorText { // if let error = self.errorText {
// Text(error).font(.callout).foregroundStyle(.red) // Text(error).font(.callout).foregroundStyle(.logoRed)
// } // }
} }

Loading…
Cancel
Save