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

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

@ -556,7 +556,11 @@ defer {
let currentRoundMatchCount = RoundRule.numberOfMatches(forRoundIndex: index)
guard currentRoundMatchCount > 1 else { return }
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 round = Round(tournament: tournament, index: $0, matchFormat: loserBracketMatchFormat)

@ -807,6 +807,12 @@ defer {
return teams + waitingListTeams(in: teams)
}
func waitingListSortedTeams() -> [TeamRegistration] {
let teams = selectedSortedTeams()
return waitingListTeams(in: teams)
}
func selectedSortedTeams() -> [TeamRegistration] {
#if DEBUG_TIME //DEBUGING TIME
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)
}
func bracketCut() -> Int {
func bracketCut(teamCount: Int) -> Int {
return max(0, teamCount - groupStageCut())
}
@ -883,10 +889,12 @@ defer {
return groupStageSpots()
}
func cutLabel(index: Int) -> String {
if index < bracketCut() {
func cutLabel(index: Int, teamCount: Int?) -> String {
let _teamCount = teamCount ?? selectedSortedTeams().count
let bracketCut = bracketCut(teamCount: _teamCount)
if index < bracketCut {
return "Tableau"
} else if index - bracketCut() < groupStageCut() {
} else if index - bracketCut < groupStageCut() && _teamCount > 0 {
return "Poule"
} else {
return "Attente"
@ -1543,7 +1551,7 @@ defer {
var _groupStages = [GroupStage]()
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)
}
@ -1566,7 +1574,7 @@ defer {
let roundCount = RoundRule.numberOfRounds(forTeams: bracketTeamCount())
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 {
@ -1579,7 +1587,7 @@ defer {
let matches = (0..<matchCount).map { //0 is final match
let roundIndex = RoundRule.roundIndex(fromMatchIndex: $0)
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 {
@ -1783,7 +1791,7 @@ defer {
teamSorting = newValue.defaultTeamSortingType
groupStageMatchFormat = groupStageSmartMatchFormat()
loserBracketMatchFormat = loserBracketSmartMatchFormat(1)
matchFormat = roundSmartMatchFormat(1)
matchFormat = roundSmartMatchFormat(5)
}
}

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

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

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

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

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

@ -34,7 +34,7 @@ struct MatchTeamDetailView: View {
EditablePlayerView(player: player, editingOptions: [.licenceId, .name, .payment])
}
} 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 {
LabeledContent {
Image(systemName: "xmark.circle.fill")
.tint(.red)
.tint(.logoRed)
} label: {
if let _mostRecentDateAvailable {
Text(_mostRecentDateAvailable.monthYearFormatted)

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

@ -11,6 +11,7 @@ struct TeamHeaderView: View {
var team: TeamRegistration
var teamIndex: Int?
var tournament: Tournament?
var teamCount: Int?
var body: some View {
HStack(spacing: 16.0) {
@ -46,7 +47,7 @@ struct TeamHeaderView: View {
} else {
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 {
Text("Déjà convoquée \(callDate.localizedDate())")
.foregroundStyle(.red)
.foregroundStyle(.logoRed)
.italic()
.font(.caption)
}

@ -492,7 +492,7 @@ struct FileImportView: View {
}
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())")
.foregroundStyle(.red)
.foregroundStyle(.logoRed)
.italic()
.font(.caption)
}

@ -91,7 +91,7 @@ struct InscriptionInfoView: View {
Text("Dans le tableau")
}
}
.listRowView(color: .red)
.listRowView(color: .logoRed)
DisclosureGroup {
ForEach(waitingListInGroupStage) { team in
@ -104,7 +104,7 @@ struct InscriptionInfoView: View {
Text("En poule")
}
}
.listRowView(color: .red)
.listRowView(color: .logoRed)
} header: {
Text("Équipes ne devant plus être sélectionnées")
} footer: {
@ -123,7 +123,7 @@ struct InscriptionInfoView: View {
Text("Doublons")
}
}
.listRowView(color: .red)
.listRowView(color: .logoRed)
}
Section {
@ -155,7 +155,7 @@ struct InscriptionInfoView: View {
Text("Joueurs trop bien classés")
}
}
.listRowView(color: .red)
.listRowView(color: .logoRed)
} footer: {
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 }
case all
case walkOut
case waiting
func localizedLabel() -> String {
switch self {
@ -105,6 +106,8 @@ struct InscriptionManagerView: View {
return "Toutes les équipes"
case .walkOut:
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])))
}
#endif
sortedTeams = tournament.sortedTeams()
if filterMode == .waiting {
sortedTeams = tournament.waitingListSortedTeams()
} else {
sortedTeams = tournament.sortedTeams()
}
}
var filteredTeams: [TeamRegistration] {
@ -511,12 +518,19 @@ struct InscriptionManagerView: View {
private func _teamRegisteredView() -> some View {
List {
let selectedSortedTeams = tournament.selectedSortedTeams()
if let closedRegistrationDate = tournament.closedRegistrationDate {
Section {
CloseDatePicker(closedRegistrationDate: closedRegistrationDate)
} footer: {
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 {
@ -560,7 +574,7 @@ struct InscriptionManagerView: View {
Section {
TeamDetailView(team: team)
} header: {
TeamHeaderView(team: team, teamIndex: teamIndex, tournament: tournament)
TeamHeaderView(team: team, teamIndex: teamIndex, tournament: tournament, teamCount: filterMode == .waiting ? 0 : selectedSortedTeams.count)
} footer: {
_teamFooterView(team)
}
@ -722,7 +736,7 @@ struct InscriptionManagerView: View {
}
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()

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

@ -102,7 +102,7 @@ struct TournamentBuildView: View {
} label: {
Text("Classement final des équipes")
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: {
Text("Classement final des équipes")
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)
} footer: {
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)
// if let error = self.errorText {
// Text(error).font(.callout).foregroundStyle(.red)
// Text(error).font(.callout).foregroundStyle(.logoRed)
// }
}

Loading…
Cancel
Save