fix stuff from pade rules july 2024

add somes links in toolbox
add comment request
clubs
Razmig Sarkissian 1 year ago
parent 6256dc0b9d
commit 7754be7eac
  1. 6
      PadelClub/Data/GroupStage.swift
  2. 2
      PadelClub/Data/Tournament.swift
  3. 23
      PadelClub/Utils/PadelRule.swift
  4. 9
      PadelClub/Utils/URLs.swift
  5. 17
      PadelClub/Views/Navigation/MainView.swift
  6. 40
      PadelClub/Views/Navigation/Organizer/TournamentOrganizerView.swift
  7. 71
      PadelClub/Views/Navigation/Toolbox/ToolboxView.swift

@ -170,6 +170,12 @@ final class GroupStage: ModelObject, Storable {
let setDifference = differences.map { $0.set }.reduce(0,+)
let gameDifference = differences.map { $0.game }.reduce(0,+)
return (team, wins, loses, setDifference, gameDifference)
/*
2 points par rencontre gagnée
1 point par rencontre perdue
-1 point en cas de rencontre perdue par disqualification (scores de 6/0 6/0 attribués aux trois matchs)
-2 points en cas de rencontre perdu par WO (scores de 6/0 6/0 attribués aux trois matchs)
*/
}
func matches(forGroupStagePosition groupStagePosition: Int) -> [Match] {

@ -1012,7 +1012,7 @@ defer {
func mandatoryRegistrationCloseDate() -> Date? {
switch tournamentLevel {
case .p500, .p1000, .p1500, .p2000:
if let date = Calendar.current.date(byAdding: .day, value: -6, to: startDate) {
if let date = Calendar.current.date(byAdding: .day, value: -13, to: startDate) {
let startOfDay = Calendar.current.startOfDay(for: date)
return Calendar.current.date(byAdding: .minute, value: -1, to: startOfDay)
}

@ -315,7 +315,7 @@ enum TournamentLevel: Int, Hashable, Codable, CaseIterable, Identifiable {
case .p25:
switch ageCategory {
case .senior, .a45, .a55:
return category == .men ? 10000 : 1000
return category == .men ? 20000 : 1000
default:
return 0
}
@ -330,6 +330,7 @@ enum TournamentLevel: Int, Hashable, Codable, CaseIterable, Identifiable {
case .p250:
switch ageCategory {
case .senior, .a45, .a55:
if category == .mix { return 0 }
return category == .men ? 500 : 100
default:
return 0
@ -365,12 +366,18 @@ enum TournamentLevel: Int, Hashable, Codable, CaseIterable, Identifiable {
} else {
return .nineGamesDecisivePoint
}
case .p1000, .p1500:
if roundIndex <= 1 { //demi / finale
case .p1000:
if roundIndex <= 3 { //demi / finale / quart / 8eme
return .twoSetsDecisivePoint
} else {
return .twoSetsDecisivePointSuperTie
}
case .p1500, .p2000:
if roundIndex <= 3 { //demi / finale / quart / 8eme
return .twoSetsDecisivePoint
} else {
return .twoSetsSuperTie
}
default:
return .superTie
}
@ -391,12 +398,12 @@ enum TournamentLevel: Int, Hashable, Codable, CaseIterable, Identifiable {
return .superTie
case .p100, .p250, .p500:
return .nineGamesDecisivePoint
case .p1000:
return .nineGamesDecisivePoint
case .p1500, .p2000:
return .twoSetsSuperTie
default:
if roundIndex <= 1 { //petite finale
return .twoSetsDecisivePointSuperTie
} else {
return .nineGamesDecisivePoint
}
return .nineGamesDecisivePoint
}
}

@ -16,8 +16,15 @@ enum URLs: String, Identifiable {
case beachPadel = "https://beach-padel.app.fft.fr/beachja/index/"
//case padelClub = "https://padelclub.app"
case tenup = "https://tenup.fft.fr"
case padelRules = "https://fft-site.cdn.prismic.io/fft-site/ZgLn3McYqOFdyF7n_LEGUIDEDELACOMPETITIONDEPADEL-MAJDECEMBRE2023.pdf"
case padelCompetitionGeneralGuide = "https://fft-site.cdn.prismic.io/fft-site/Zqi2PB5LeNNTxlrS_1-REGLESGENERALESDELACOMPETITION-ANNEESPORTIVE2025.pdf"
case padelCompetitionSpecificGuide = "https://fft-site.cdn.prismic.io/fft-site/Zqi4ax5LeNNTxlsu_3-CAHIERDESCHARGESDESTOURNOIS-ANNEESPORTIVE2025.pdf"
case padelRules = "https://fft-site.cdn.prismic.io/fft-site/ZgLnkMcYqOFdyF7i_L%27arbitragedupadel-édition2023_0.pdf"
case restingDischarge = "https://club.fft.fr/tennisfirmidecazeville/60120370_d/data_1/pdf/fo/formlairededechargederesponsabilitetournoidepadel.pdf"
case appReview = "https://apps.apple.com/app/padel-club/id6484163558?mt=8&action=write-review"
case appDescription = "https://padelclub.app/download/"
case instagram = "https://www.instagram.com/padelclub.app?igsh=bmticnV5YWhpMnBn"
case appStore = "https://apps.apple.com/app/padel-club/id6484163558"
var id: String { return self.rawValue }
var url: URL {

@ -7,9 +7,11 @@
import SwiftUI
import LeStorage
import StoreKit
struct MainView: View {
@EnvironmentObject var dataStore: DataStore
@Environment(\.requestReview) var requestReview
@AppStorage("importingFiles") var importingFiles: Bool = false
@Environment(NavigationViewModel.self) private var navigation: NavigationViewModel
@ -68,6 +70,12 @@ struct MainView: View {
await self._checkSourceFileAvailability()
}
}
#if DEBUG
#else
_requestReviewIfAppropriated()
#endif
}
.toolbarBackground(.visible, for: .tabBar)
TournamentOrganizerView()
@ -134,6 +142,15 @@ struct MainView: View {
}
}
@MainActor
private func _requestReviewIfAppropriated() {
let isConnected = StoreCenter.main.userId != nil
let numberOfSignificantTournaments = dataStore.tournaments.filter({ $0.isDeleted == false && $0.endDate != nil }).count
if isConnected || numberOfSignificantTournaments > 0 {
requestReview()
}
}
func _activityStatusBoxView() -> some View {
return _activityStatus()
.toastFormatted()

@ -30,28 +30,30 @@ struct TournamentOrganizerView: View {
.toolbarBackground(.visible, for: .navigationBar)
}
}
Divider()
HStack {
ScrollViewReader { proxy in
ScrollView(.horizontal) {
HStack {
let tournaments = dataStore.tournaments.filter({ $0.hasEnded() == false && $0.isDeleted == false && $0.isCanceled == false }).sorted(by: \.startDate).reversed()
ForEach(tournaments) { tournament in
TournamentButtonView(tournament: tournament)
.id(tournament.id)
let tournaments = dataStore.tournaments.filter({ $0.hasEnded() == false && $0.isDeleted == false && $0.isCanceled == false }).sorted(by: \.startDate).reversed()
if tournaments.isEmpty == false {
Divider()
HStack {
ScrollViewReader { proxy in
ScrollView(.horizontal) {
HStack {
ForEach(tournaments) { tournament in
TournamentButtonView(tournament: tournament)
.id(tournament.id)
}
}
.padding()
.buttonStyle(.plain)
}
.padding()
.buttonStyle(.plain)
}
.onAppear {
if let selectedDestination = navigation.organizerTournament {
proxy.scrollTo(selectedDestination.id, anchor: .center)
.onAppear {
if let selectedDestination = navigation.organizerTournament {
proxy.scrollTo(selectedDestination.id, anchor: .center)
}
}
}
.onChange(of: navigation.organizerTournament) {
if let selectedDestination = navigation.organizerTournament {
proxy.scrollTo(selectedDestination.id, anchor: .center)
.onChange(of: navigation.organizerTournament) {
if let selectedDestination = navigation.organizerTournament {
proxy.scrollTo(selectedDestination.id, anchor: .center)
}
}
}
}

@ -31,23 +31,24 @@ struct ToolboxView: View {
@Bindable var navigation = navigation
NavigationStack(path: $navigation.toolboxPath) {
List {
Section {
Text("Version de l'application").badge(PadelClubApp.appVersion)
.onTapGesture(count: 5) {
StoreCenter.main.resetApiCalls()
didResetApiCalls = true
}
SupportButtonView(contentIsUnavailable: false)
Link(destination: URLs.main.url) {
Text("Accéder au site Padel Club")
Text("Accéder à padelclub.app")
}
.contextMenu {
ShareLink(item: URLs.main.url)
}
}
SupportButtonView(contentIsUnavailable: false)
Link(destination: URLs.appReview.url) {
Text("Partagez vos impressions !")
}
Link(destination: URLs.instagram.url) {
Text("Compte Instagram PadelClub.app")
}
}
#if DEBUG
@ -125,6 +126,20 @@ struct ToolboxView: View {
}
#endif
Section {
NavigationLink {
SelectablePlayerListView()
} label: {
Label("Rechercher un joueur", systemImage: "person.fill.viewfinder")
}
NavigationLink {
RankCalculatorView()
} label: {
Label("Calculateur de points", systemImage: "scalemass")
}
}
Section {
NavigationLink {
PadelClubView()
@ -154,24 +169,22 @@ struct ToolboxView: View {
}
Section {
NavigationLink {
SelectablePlayerListView()
} label: {
Label("Rechercher un joueur", systemImage: "person.fill.viewfinder")
}
NavigationLink {
RankCalculatorView()
} label: {
Label("Calculateur de points", systemImage: "scalemass")
}
Link("Accéder au guide de la compétition", destination: URLs.padelCompetitionGeneralGuide.url)
Link("Accéder aux CDC des tournois", destination: URLs.padelCompetitionSpecificGuide.url)
Link("Accéder aux règles du jeu", destination: URLs.padelRules.url)
Link("Décharge des temps de repos", destination: URLs.restingDischarge.url)
} header: {
Text("Documents fédéraux")
.onTapGesture(count: 5) {
StoreCenter.main.resetApiCalls()
didResetApiCalls = true
}
}
Section {
Link("Accéder au guide de la compétition", destination: URLs.padelRules.url)
Link("Formulaire de décharge des temps de repos", destination: URLs.restingDischarge.url)
} header: {
Text("Documents fédéraux")
Link(destination: URLs.appDescription.url) {
Text("Page de présentation de Padel Club")
}
}
}
@ -187,8 +200,14 @@ struct ToolboxView: View {
}
}
}
.navigationTitle(TabDestination.toolbox.title)
.toolbar {
ToolbarItem(placement: .topBarTrailing) {
Link(destination: URLs.appStore.url) {
Text("v\(PadelClubApp.appVersion)")
}
}
}
}
}
}

Loading…
Cancel
Save