add loser bracket in pdf

newoffer2025
Raz 6 months ago
parent 85442dc822
commit 0aa515ea9f
  1. 17
      PadelClubData/Data/Match.swift
  2. 4
      PadelClubData/Data/Round.swift

@ -191,13 +191,22 @@ defer {
}
}
public func scoreLabel() -> String {
public func scoreLabel(winnerFirst: Bool = false) -> String {
if hasWalkoutTeam() == true {
return "WO"
}
let scoreOne = teamScore(.one)?.score?.components(separatedBy: ",") ?? []
let scoreTwo = teamScore(.two)?.score?.components(separatedBy: ",") ?? []
let tuples = zip(scoreOne, scoreTwo).map { ($0, $1) }
var tuples = zip(scoreOne, scoreTwo).map { ($0, $1) }
if winnerFirst {
if teamWon(atPosition: .one) {
} else {
tuples = zip(scoreTwo, scoreOne).map { ($0, $1) }
}
}
let scores = tuples.map { $0 + "/" + $1 }.joined(separator: " ")
return scores
}
@ -1066,6 +1075,10 @@ defer {
[MatchSpot(match: self, teamPosition: .one), MatchSpot(match: self, teamPosition: .two)]
}
public func initialStartDate() -> Date? {
plannedStartDate ?? startDate
}
func insertOnServer() {
self.tournamentStore?.matches.writeChangeAndInsertOnServer(instance: self)
for teamScore in self.teamScores {

@ -907,6 +907,10 @@ defer {
_cachedLoserRoundsAndChildren = nil
}
public func initialStartDate() -> Date? {
plannedStartDate ?? startDate ?? playedMatches().first?.initialStartDate()
}
public override func deleteDependencies(store: Store, shouldBeSynchronized: Bool) {
store.deleteDependencies(type: Match.self, shouldBeSynchronized: shouldBeSynchronized) { $0.round == self.id }

Loading…
Cancel
Save