Show full playoff bracket, mark series results, harden API decoding
Playoffs: - List every round played so far (Round 1 → current) instead of only the current round, on both macOS menu and iPhone - Strike through the eliminated team's tricode in a finished series and drop the now-redundant "(Final … wins)" tag on completed earlier rounds - Refetch the bracket when a finished game implies more completed games than the cached bracket records, so the series score and round no longer get stuck on stale data after cold launch or the NHL bracket endpoint's lag API robustness: - Tolerate optional gameCenterLink/startTimeUTC on TBD playoff matchups so the scoreboard decode no longer aborts - Reject API state regressions via a monotonic FUT→…→OFF progression rank so a brief glitch can't downgrade a finished game back to "-:-"
This commit is contained in:
@@ -40,6 +40,12 @@ struct PlayoffBracket: Codable {
|
||||
return topSeedWins == 4 ? topSeedTeam?.abbrev : bottomSeedTeam?.abbrev
|
||||
}
|
||||
|
||||
/// Abbrev of the eliminated side, nil if the series is ongoing.
|
||||
var loser: String? {
|
||||
guard isOver else { return nil }
|
||||
return topSeedWins == 4 ? bottomSeedTeam?.abbrev : topSeedTeam?.abbrev
|
||||
}
|
||||
|
||||
/// Absolute URL for the NHL.com series page, or nil if the bracket doesn't provide one.
|
||||
var fullSeriesUrl: String? {
|
||||
seriesUrl.map { "https://www.nhl.com\($0)" }
|
||||
@@ -63,7 +69,17 @@ struct PlayoffBracket: Codable {
|
||||
/// All matched series in the current round.
|
||||
var currentRoundSeries: [Series] {
|
||||
guard let round = currentRound else { return [] }
|
||||
return series
|
||||
return matchedSeries(inRound: round)
|
||||
}
|
||||
|
||||
/// Rounds that have at least one matched series, ascending (1…current).
|
||||
var activeRounds: [Int] {
|
||||
Set(series.filter(\.isMatched).map(\.playoffRound)).sorted()
|
||||
}
|
||||
|
||||
/// All matched series in the given round, sorted by series letter.
|
||||
func matchedSeries(inRound round: Int) -> [Series] {
|
||||
series
|
||||
.filter { $0.playoffRound == round && $0.isMatched }
|
||||
.sorted { $0.seriesLetter < $1.seriesLetter }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user