minor fixes

paca_championship
Raz 1 year ago
parent 566c5c1eac
commit af1ea610b4
  1. 8
      PadelClub.xcodeproj/project.pbxproj
  2. 4
      PadelClub/Data/GroupStage.swift
  3. 3
      PadelClub/Data/Tournament.swift
  4. 10
      PadelClub/Extensions/FixedWidthInteger+Extensions.swift
  5. 9
      PadelClub/Utils/PadelRule.swift
  6. 8
      PadelClub/Views/GroupStage/Components/GroupStageSettingsView.swift
  7. 2
      PadelClub/Views/GroupStage/GroupStageView.swift
  8. 5
      PadelClub/Views/Shared/MatchFormatRowView.swift
  9. 3
      PadelClub/Views/Shared/MatchTypeSelectionView.swift

@ -3383,7 +3383,7 @@
CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\"";
@ -3406,7 +3406,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.24;
MARKETING_VERSION = 1.0.25;
PRODUCT_BUNDLE_IDENTIFIER = app.padelclub;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@ -3427,7 +3427,7 @@
CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\"";
DEVELOPMENT_TEAM = BQ3Y44M3Q6;
@ -3449,7 +3449,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.24;
MARKETING_VERSION = 1.0.25;
PRODUCT_BUNDLE_IDENTIFIER = app.padelclub;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";

@ -221,8 +221,8 @@ final class GroupStage: ModelObject, Storable {
func scoreLabel(forGroupStagePosition groupStagePosition: Int, score: TeamGroupStageScore? = nil) -> (wins: String, losses: String, setsDifference: String?, gamesDifference: String?)? {
if let scoreData = (score ?? _score(forGroupStagePosition: groupStagePosition, nilIfEmpty: true)) {
let hideSetDifference = matchFormat.setsToWin == 1
let setDifference = scoreData.setDifference.formatted(.number.sign(strategy: .always(includingZero: false)))
let gameDifference = scoreData.gameDifference.formatted(.number.sign(strategy: .always(includingZero: false)))
let setDifference = scoreData.setDifference.formatted(.number.sign(strategy: .always(includingZero: true))) + " set" + scoreData.setDifference.pluralSuffix
let gameDifference = scoreData.gameDifference.formatted(.number.sign(strategy: .always(includingZero: true))) + " jeu" + scoreData.gameDifference.localizedPluralSuffix("x")
return (wins: scoreData.wins.formatted(), losses: scoreData.loses.formatted(), setsDifference: hideSetDifference ? nil : setDifference, gamesDifference: gameDifference)
// return "\(scoreData.wins)/\(scoreData.loses) " + differenceAsString
} else {

@ -152,17 +152,18 @@ final class Tournament : ModelObject, Storable {
self.publishBrackets = true
self.publishGroupStages = true
self.publishRankings = true
self.publishTournament = true
#else
self.publishTeams = publishTeams
self.publishSummons = publishSummons
self.publishBrackets = publishBrackets
self.publishGroupStages = publishGroupStages
self.publishRankings = publishRankings
self.publishTournament = publishTournament
#endif
self.shouldVerifyBracket = shouldVerifyBracket
self.shouldVerifyGroupStage = shouldVerifyGroupStage
self.hideTeamsWeight = hideTeamsWeight
self.publishTournament = publishTournament
self.hidePointsEarned = hidePointsEarned
self.loserBracketMode = loserBracketMode
self.initialSeedRound = initialSeedRound

@ -19,8 +19,16 @@ public extension FixedWidthInteger {
return self.formatted() + self.ordinalFormattedSuffix(feminine: feminine)
}
private var isMany: Bool {
self > 1 || self < -1
}
var pluralSuffix: String {
return self > 1 ? "s" : ""
return isMany ? "s" : ""
}
func localizedPluralSuffix(_ plural: String = "s") -> String {
return isMany ? plural : ""
}
func formattedAsRawString() -> String {

@ -1349,8 +1349,13 @@ enum MatchFormat: Int, Hashable, Codable, CaseIterable, Identifiable {
return setFormat
}
func formatTitle() -> String {
["Format ", shortFormat, suffix].joined()
func formatTitle(_ displayStyle: DisplayStyle = .wide) -> String {
switch displayStyle {
case .short:
return ["Format ", shortFormat].joined()
default:
return ["Format ", shortFormat, suffix].joined()
}
}
var suffix: String {

@ -181,6 +181,10 @@ struct GroupStageSettingsView: View {
presentConfirmationButton = true
}
}
.onChange(of: groupStage.matchFormat) {
_save()
groupStage.updateAllMatchesFormat()
}
.navigationBarBackButtonHidden(focusedField != nil)
.toolbar(content: {
if focusedField != nil {
@ -190,6 +194,10 @@ struct GroupStageSettingsView: View {
}
}
}
ToolbarItem(placement: .topBarTrailing) {
MatchTypeSelectionView(selectedFormat: $groupStage.matchFormat, additionalEstimationDuration: tournament.additionalEstimationDuration, displayStyle: .short)
}
})
.navigationTitle("Paramètres")
.toolbarBackground(.visible, for: .navigationBar)

@ -165,13 +165,11 @@ struct GroupStageView: View {
if let setsDifference = score.setsDifference {
HStack(spacing: 4.0) {
Text(setsDifference)
Text("sets")
}.font(.footnote)
}
if let gamesDifference = score.gamesDifference {
HStack(spacing: 4.0) {
Text(gamesDifference)
Text("jeux")
}.font(.footnote)
}
}

@ -13,6 +13,7 @@ struct MatchFormatRowView: View {
var hideExplanation: Bool = false
var hideDuration: Bool = false
var additionalEstimationDuration: Int?
var displayStyle: DisplayStyle = .wide
var body: some View {
VStack(alignment: .leading) {
@ -26,8 +27,8 @@ struct MatchFormatRowView: View {
}
}
HStack {
Text(matchFormat.formatTitle())
if hideDuration == false {
Text(matchFormat.formatTitle(displayStyle))
if hideDuration == false && displayStyle != .short {
Spacer()
Text("~" + matchFormat.formattedEstimatedDuration(additionalEstimationDuration ?? 0))
}

@ -11,6 +11,7 @@ struct MatchTypeSelectionView: View {
@Binding var selectedFormat: MatchFormat
var format: String?
var additionalEstimationDuration: Int?
var displayStyle: DisplayStyle = .wide
var body: some View {
NavigationLink {
@ -18,7 +19,7 @@ struct MatchTypeSelectionView: View {
.navigationTitle("Choix du format")
.toolbarBackground(.visible, for: .navigationBar)
} label: {
MatchFormatRowView(matchFormat: selectedFormat, headerLabel: format, hideExplanation: true, additionalEstimationDuration: additionalEstimationDuration)
MatchFormatRowView(matchFormat: selectedFormat, headerLabel: format, hideExplanation: true, additionalEstimationDuration: additionalEstimationDuration, displayStyle: displayStyle)
}
}
}

Loading…
Cancel
Save