fix live scoring

fix p1500 points repartition
fix planning view stuff
newoffer2025
Raz 6 months ago
parent 899a1c419c
commit 9cb968c441
  1. 16
      PadelClub/Views/Planning/PlanningView.swift

@ -33,7 +33,7 @@ struct PlanningView: View {
}
var timeSlots: [Date: [Match]] {
Dictionary(grouping: matches) { $0.startDate ?? .distantFuture }
Dictionary(grouping: matches) { $0.plannedStartDate ?? $0.startDate ?? .distantFuture }
}
func days(timeSlots: [Date: [Match]]) -> [Date] {
@ -279,7 +279,7 @@ struct PlanningView: View {
self.selectedFormats = Array(Set(selectedMatches.map({ match in
match.matchFormat
})))
_dateToUpdate = .init(wrappedValue: selectedMatches.first?.startDate ?? Date())
_dateToUpdate = .init(wrappedValue: selectedMatches.first?.plannedStartDate ?? selectedMatches.first?.startDate ?? Date())
}
var body: some View {
@ -328,7 +328,15 @@ struct PlanningView: View {
private func _updateDate() {
selectedMatches.forEach { match in
match.startDate = dateToUpdate
if match.hasStarted() || match.hasEnded() {
match.plannedStartDate = dateToUpdate
} else {
let hasStarted = match.currentTournament()?.hasStarted() == true
match.startDate = dateToUpdate
if hasStarted {
match.plannedStartDate = dateToUpdate
}
}
}
let groupByTournaments = selectedMatches.grouped { match in
@ -501,6 +509,8 @@ struct PlanningView: View {
if matchViewStyle == .feedStyle, let tournament = match.currentTournament() {
Text(tournament.tournamentTitle())
}
Text(match.startDate?.formattedAsHourMinute() ?? "--")
}
}
}

Loading…
Cancel
Save