|
|
|
|
@ -1151,7 +1151,7 @@ defer { |
|
|
|
|
return allMatches.filter({ $0.isReady() && $0.isRunning() == false && $0.hasEnded() == false }).sorted(by: \.computedStartDateForSorting) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func finishedMatches(_ allMatches: [Match], limit: Int? = nil) -> [Match] { |
|
|
|
|
func finishedMatches(_ allMatches: [Match], limit: Int?) -> [Match] { |
|
|
|
|
#if _DEBUG_TIME //DEBUGING TIME |
|
|
|
|
let start = Date() |
|
|
|
|
defer { |
|
|
|
|
@ -1159,8 +1159,11 @@ defer { |
|
|
|
|
print("func tournament finishedMatches", id, duration.formatted(.units(allowed: [.seconds, .milliseconds]))) |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
let _limit = limit ?? courtCount |
|
|
|
|
return Array(allMatches.filter({ $0.hasEnded() }).sorted(by: \.computedEndDateForSorting).reversed().prefix(_limit)) |
|
|
|
|
if let limit { |
|
|
|
|
return Array(allMatches.filter({ $0.hasEnded() }).sorted(by: \.computedEndDateForSorting).reversed().prefix(limit)) |
|
|
|
|
} else { |
|
|
|
|
return Array(allMatches.filter({ $0.hasEnded() }).sorted(by: \.computedEndDateForSorting).reversed()) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func teamsRanked() -> [TeamRegistration] { |
|
|
|
|
|