fix text stuff

multistore
Razmig Sarkissian 1 year ago
parent 89d62ae118
commit ea0159e3df
  1. 4
      PadelClub.xcodeproj/project.pbxproj
  2. 4
      PadelClub/Data/Round.swift
  3. 30
      PadelClub/Data/Tournament.swift
  4. 2
      PadelClub/Utils/PadelRule.swift
  5. 2
      PadelClub/Views/Calling/CallSettingsView.swift
  6. 6
      PadelClub/Views/Planning/SchedulerView.swift
  7. 2
      PadelClub/Views/Tournament/Screen/TournamentScheduleView.swift
  8. 10
      PadelClub/Views/Tournament/TournamentBuildView.swift
  9. 10
      PadelClub/Views/Tournament/TournamentInitView.swift

@ -1878,7 +1878,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 69;
CURRENT_PROJECT_VERSION = 71;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\"";
@ -1918,7 +1918,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 69;
CURRENT_PROJECT_VERSION = 71;
DEFINES_MODULE = YES;
DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\"";
DEVELOPMENT_TEAM = BQ3Y44M3Q6;

@ -36,7 +36,7 @@ class Round: ModelObject, Storable {
}
func _matches() -> [Match] {
return DataStore.shared.matches.filter { $0.round == self.id }
return DataStore.shared.matches.filter { $0.round == self.id }.sorted(by: \.index)
}
func getDisabledMatches() -> [Match] {
@ -249,7 +249,7 @@ defer {
}
func enabledMatches() -> [Match] {
return DataStore.shared.matches.filter { $0.round == self.id && $0.disabled == false }
return DataStore.shared.matches.filter { $0.round == self.id && $0.disabled == false }.sorted(by: \.index)
}
func displayableMatches() -> [Match] {

@ -1394,20 +1394,28 @@ defer {
return TournamentStatus(label: label, completion: completionLabel)
}
func bracketStatus() async -> (status: String, cut: TeamRegistration.TeamRange?) {
func bracketStatus() async -> (status: String, description: String?, cut: TeamRegistration.TeamRange?) {
let availableSeeds = availableSeeds()
let cut = TeamRegistration.TeamRange(availableSeeds.first, availableSeeds.last)
var description: String? = nil
if availableSeeds.isEmpty == false {
return ("placer \(availableSeeds.count) tête\(availableSeeds.count.pluralSuffix) de série", cut)
description = "placer \(availableSeeds.count) équipe\(availableSeeds.count.pluralSuffix)"
}
if description == nil {
let availableQualifiedTeams = availableQualifiedTeams()
if availableQualifiedTeams.isEmpty == false {
return ("placer \(availableQualifiedTeams.count) qualifié" + availableQualifiedTeams.count.pluralSuffix, cut)
description = "placer \(availableQualifiedTeams.count) qualifié" + availableQualifiedTeams.count.pluralSuffix
}
}
var cut: TeamRegistration.TeamRange? = nil
if description == nil && isAnimation() == false {
cut = TeamRegistration.TeamRange(availableSeeds.first, availableSeeds.last)
}
if let round = getActiveRound() {
return ([round.roundTitle(.short), round.roundStatus()].joined(separator: " "), cut)
return ([round.roundTitle(.short), round.roundStatus()].joined(separator: " ").lowercased(), description, cut)
} else {
return ("à construire", nil)
return ("", description, nil)
}
}
@ -1415,10 +1423,10 @@ defer {
let groupStageTeams = groupStageTeams()
let groupStageTeamsCount = groupStageTeams.count
if groupStageTeamsCount == 0 || groupStageTeamsCount != groupStageSpots() {
return ("à faire", nil)
return ("à compléter", nil)
}
let cut = TeamRegistration.TeamRange(groupStageTeams.first, groupStageTeams.last)
let cut : TeamRegistration.TeamRange? = isAnimation() ? nil : TeamRegistration.TeamRange(groupStageTeams.first, groupStageTeams.last)
let runningGroupStages = groupStages().filter({ $0.isRunning() })
if groupStagesAreOver() { return ("terminées", cut) }
@ -1435,17 +1443,13 @@ defer {
}
func settingsDescriptionLocalizedLabel() -> String {
[dayDuration.formatted() + " jour\(dayDuration.pluralSuffix)", courtCount.formatted() + " terrain\(courtCount.pluralSuffix)"].joined(separator: ", ")
[courtCount.formatted() + " terrain\(courtCount.pluralSuffix)", entryFeeMessage].joined(separator: ", ")
}
func structureDescriptionLocalizedLabel() -> String {
if state() == .initial {
return "à valider"
} else {
let groupStageLabel: String? = groupStageCount > 0 ? groupStageCount.formatted() + " poule\(groupStageCount.pluralSuffix)" : nil
return [teamCount.formatted() + " équipes", groupStageLabel].compactMap({ $0 }).joined(separator: ", ")
}
}
func deleteAndBuildEverything() {
deleteStructure()

@ -342,7 +342,7 @@ enum TournamentLevel: Int, Hashable, Codable, CaseIterable, Identifiable {
return .twoSetsDecisivePointSuperTie
}
default:
return .twoSetsDecisivePoint
return .superTie
}
}

@ -46,7 +46,7 @@ struct CallSettingsView: View {
Logger.error(error)
}
} label: {
Text(.init("Le tournoi n'est pas visible sur [Padel Club](\(URLs.main.rawValue)), ")).foregroundStyle(.logoRed) + Text("le rendre visible ?").underline().foregroundStyle(.master)
Text(.init("Le tournoi est privée, le publier ?")).underline().foregroundStyle(.master)
}
}
}

@ -50,6 +50,7 @@ struct SchedulerView: View {
}
} footer: {
if tournament.isAnimation() == false {
if tournament.groupStageMatchFormat.weight > tournament.groupStageSmartMatchFormat().weight {
Button {
tournament.groupStageMatchFormat = tournament.groupStageSmartMatchFormat()
@ -59,6 +60,7 @@ struct SchedulerView: View {
.buttonStyle(.plain)
}
}
}
ForEach(tournament.groupStages()) {
GroupStageScheduleEditorView(groupStage: $0, tournament: tournament)
@ -117,6 +119,7 @@ struct SchedulerView: View {
} header: {
Text(round.titleLabel())
} footer: {
if tournament.isAnimation() == false {
let federalFormat = tournament.roundSmartMatchFormat(round.index)
if round.matchFormat.weight > federalFormat.weight {
Button {
@ -132,6 +135,7 @@ struct SchedulerView: View {
.buttonStyle(.plain)
}
}
}
if round.index != 0 {
Section {
@ -160,7 +164,7 @@ struct SchedulerView: View {
} header: {
Text("Match de classement \(round.roundTitle(.short))")
} footer: {
if round.index == 1, let semi = round.loserRounds().first {
if tournament.isAnimation() == false, round.index == 1, let semi = round.loserRounds().first {
let federalFormat = tournament.loserBracketSmartMatchFormat(1)
if semi.matchFormat.weight > federalFormat.weight {
Button {

@ -92,7 +92,7 @@ struct TournamentScheduleView: View {
}
.navigationBarTitleDisplayMode(.inline)
.toolbarBackground(.visible, for: .navigationBar)
.navigationTitle("Horaires")
.navigationTitle("Horaires et formats")
}
}

@ -9,7 +9,7 @@ import SwiftUI
struct TournamentBuildView: View {
var tournament: Tournament
@State private var bracketStatus: (status: String, cut: TeamRegistration.TeamRange?)?
@State private var bracketStatus: (status: String, description: String?, cut: TeamRegistration.TeamRange?)?
@State private var groupStageStatus: (String, TeamRegistration.TeamRange?)?
@State private var callStatus: Tournament.TournamentStatus?
@State private var scheduleStatus: Tournament.TournamentStatus?
@ -65,7 +65,9 @@ struct TournamentBuildView: View {
Text("Tableau")
if tournament.shouldVerifyBracket {
Text("Vérifier la tableau").foregroundStyle(.logoRed)
} else if let range = bracketStatus?.1 {
} else if let description = bracketStatus?.1 {
Text(description)
} else if let range = bracketStatus?.2 {
HStack {
if let left = range.left {
Text(left.weight.formatted())
@ -98,7 +100,6 @@ struct TournamentBuildView: View {
TournamentBroadcastRowView(tournament: tournament)
}
if state != .finished {
NavigationLink(value: Screen.schedule) {
let tournamentStatus = scheduleStatus
LabeledContent {
@ -108,7 +109,7 @@ struct TournamentBuildView: View {
ProgressView()
}
} label: {
Text("Horaires")
Text("Horaires et formats")
if let tournamentStatus {
Text(tournamentStatus.label).lineLimit(1)
} else {
@ -140,7 +141,6 @@ struct TournamentBuildView: View {
.task {
callStatus = await tournament.callStatus()
}
}
NavigationLink(value: Screen.cashier) {
let tournamentStatus = cashierStatus

@ -28,17 +28,23 @@ struct TournamentInitView: View {
NavigationLink(value: Screen.structure) {
LabeledContent {
Text(tournament.structureDescriptionLocalizedLabel())
if tournament.state() == .initial {
Text("à valider")
} else {
Image(systemName: "checkmark").foregroundStyle(.green)
}
} label: {
LabelStructure()
Text(tournament.structureDescriptionLocalizedLabel())
}
}
NavigationLink(value: Screen.settings) {
LabeledContent {
Text(tournament.settingsDescriptionLocalizedLabel())
Text(tournament.tournamentTitle(.short))
} label: {
LabelSettings()
Text("Formats, statut, club, prix, etc.")
}
}

Loading…
Cancel
Save