fix(data): add timezone handling for Sports-Reference scrapers and new stadiums
- Add ET timezone (America/New_York) to all Sports-Reference scrapers:
- NBA: Basketball-Reference times parsed as ET
- NFL: Pro-Football-Reference times parsed as ET
- NHL: Hockey-Reference times parsed as ET
- MLB: Baseball-Reference times parsed as ET
- Document source timezones in scraper docstrings
- Add 11 new stadiums to STADIUM_MAPPINGS:
- NFL: 5 international venues (Corinthians Arena, Croke Park,
Olympic Stadium Berlin, Santiago Bernabéu, Tom Benson Hall of Fame)
- MLS: 4 alternate venues (Miami Freedom Park, Citi Field,
LA Memorial Coliseum, M&T Bank Stadium)
- NWSL: 2 alternate venues (Northwestern Medicine Field, ONE Spokane)
- Add 15 stadium aliases for MLS/NWSL team-based lookups
- Fix CanonicalSyncService to sync timezone identifier to SwiftData
- Update debug logging to use stadium timezone for display
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -582,6 +582,7 @@ actor CanonicalSyncService {
|
||||
existing.yearOpened = remote.yearOpened
|
||||
existing.imageURL = remote.imageURL?.absoluteString
|
||||
existing.sport = remote.sport.rawValue
|
||||
existing.timezoneIdentifier = remote.timeZoneIdentifier
|
||||
existing.source = .cloudKit
|
||||
existing.lastModified = Date()
|
||||
|
||||
@@ -607,7 +608,8 @@ actor CanonicalSyncService {
|
||||
capacity: remote.capacity,
|
||||
yearOpened: remote.yearOpened,
|
||||
imageURL: remote.imageURL?.absoluteString,
|
||||
sport: remote.sport.rawValue
|
||||
sport: remote.sport.rawValue,
|
||||
timezoneIdentifier: remote.timeZoneIdentifier
|
||||
)
|
||||
context.insert(canonical)
|
||||
return .applied
|
||||
|
||||
@@ -120,7 +120,7 @@ final class ScheduleViewModel {
|
||||
let nbaGames = games.filter { $0.game.sport == .nba }
|
||||
print("🏀 [DEBUG] All NBA games in schedule (\(nbaGames.count) total):")
|
||||
for game in nbaGames.sorted(by: { $0.game.dateTime < $1.game.dateTime }) {
|
||||
let dateStr = game.game.dateTime.formatted(date: .abbreviated, time: .shortened)
|
||||
let dateStr = game.game.dateTime.gameDateTimeString(in: game.stadium.timeZone)
|
||||
print("🏀 \(dateStr): \(game.awayTeam.name) @ \(game.homeTeam.name) (\(game.game.id))")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user