wip
This commit is contained in:
@@ -107,7 +107,7 @@ class Game:
|
|||||||
"away_team_canonical_id": self.away_team_id,
|
"away_team_canonical_id": self.away_team_id,
|
||||||
"stadium_canonical_id": self.stadium_id,
|
"stadium_canonical_id": self.stadium_id,
|
||||||
"is_playoff": is_playoff,
|
"is_playoff": is_playoff,
|
||||||
"broadcast": broadcast,
|
"broadcast_info": broadcast,
|
||||||
}
|
}
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ class Stadium:
|
|||||||
"sport": self.sport.upper(), # iOS Sport enum expects uppercase (e.g., "NFL")
|
"sport": self.sport.upper(), # iOS Sport enum expects uppercase (e.g., "NFL")
|
||||||
"primary_team_abbrevs": primary_team_abbrevs or [],
|
"primary_team_abbrevs": primary_team_abbrevs or [],
|
||||||
"year_opened": self.opened_year,
|
"year_opened": self.opened_year,
|
||||||
|
"timezone_identifier": self.timezone,
|
||||||
}
|
}
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
@@ -135,6 +135,12 @@ STADIUM_MAPPINGS: dict[str, dict[str, StadiumInfo]] = {
|
|||||||
"stadium_mlb_spring_lecom_park": StadiumInfo("stadium_mlb_spring_lecom_park", "LECOM Park", "Bradenton", "FL", "USA", "mlb", 27.4939, -82.5753),
|
"stadium_mlb_spring_lecom_park": StadiumInfo("stadium_mlb_spring_lecom_park", "LECOM Park", "Bradenton", "FL", "USA", "mlb", 27.4939, -82.5753),
|
||||||
"stadium_mlb_spring_charlotte_sports_park": StadiumInfo("stadium_mlb_spring_charlotte_sports_park", "Charlotte Sports Park", "Port Charlotte", "FL", "USA", "mlb", 26.9992, -82.1817),
|
"stadium_mlb_spring_charlotte_sports_park": StadiumInfo("stadium_mlb_spring_charlotte_sports_park", "Charlotte Sports Park", "Port Charlotte", "FL", "USA", "mlb", 26.9992, -82.1817),
|
||||||
"stadium_mlb_spring_cacti_park": StadiumInfo("stadium_mlb_spring_cacti_park", "CACTI Park of the Palm Beaches", "West Palm Beach", "FL", "USA", "mlb", 26.7697, -80.1014),
|
"stadium_mlb_spring_cacti_park": StadiumInfo("stadium_mlb_spring_cacti_park", "CACTI Park of the Palm Beaches", "West Palm Beach", "FL", "USA", "mlb", 26.7697, -80.1014),
|
||||||
|
"stadium_mlb_spring_joker_marchant": StadiumInfo("stadium_mlb_spring_joker_marchant", "Publix Field at Joker Marchant Stadium", "Lakeland", "FL", "USA", "mlb", 28.0655, -81.9545),
|
||||||
|
# Special venues
|
||||||
|
"stadium_mlb_las_vegas_ballpark": StadiumInfo("stadium_mlb_las_vegas_ballpark", "Las Vegas Ballpark", "Las Vegas", "NV", "USA", "mlb", 36.0925, -115.1775, "America/Los_Angeles"),
|
||||||
|
"stadium_mlb_mexico_alfredo_harp_helu": StadiumInfo("stadium_mlb_mexico_alfredo_harp_helu", "Estadio Alfredo Harp Helu", "Mexico City", "CDMX", "Mexico", "mlb", 19.3825, -99.0928, "America/Mexico_City"),
|
||||||
|
"stadium_mlb_field_of_dreams": StadiumInfo("stadium_mlb_field_of_dreams", "Field of Dreams", "Dyersville", "IA", "USA", "mlb", 42.4671, -91.1095, "America/Chicago"),
|
||||||
|
"stadium_mlb_journey_bank_ballpark": StadiumInfo("stadium_mlb_journey_bank_ballpark", "Journey Bank Ballpark", "Williamsport", "PA", "USA", "mlb", 41.2415, -77.0011),
|
||||||
},
|
},
|
||||||
"nfl": {
|
"nfl": {
|
||||||
"stadium_nfl_state_farm_stadium": StadiumInfo("stadium_nfl_state_farm_stadium", "State Farm Stadium", "Glendale", "AZ", "USA", "nfl", 33.5276, -112.2626),
|
"stadium_nfl_state_farm_stadium": StadiumInfo("stadium_nfl_state_farm_stadium", "State Farm Stadium", "Glendale", "AZ", "USA", "nfl", 33.5276, -112.2626),
|
||||||
|
|||||||
@@ -1822,5 +1822,107 @@
|
|||||||
"stadium_canonical_id": "stadium_mlb_spring_cacti_park",
|
"stadium_canonical_id": "stadium_mlb_spring_cacti_park",
|
||||||
"valid_from": null,
|
"valid_from": null,
|
||||||
"valid_until": null
|
"valid_until": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias_name": "publix field at joker marchant stadium",
|
||||||
|
"stadium_canonical_id": "stadium_mlb_spring_joker_marchant",
|
||||||
|
"valid_from": null,
|
||||||
|
"valid_until": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias_name": "joker marchant stadium",
|
||||||
|
"stadium_canonical_id": "stadium_mlb_spring_joker_marchant",
|
||||||
|
"valid_from": null,
|
||||||
|
"valid_until": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias_name": "publix field",
|
||||||
|
"stadium_canonical_id": "stadium_mlb_spring_joker_marchant",
|
||||||
|
"valid_from": null,
|
||||||
|
"valid_until": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias_name": "lakeland",
|
||||||
|
"stadium_canonical_id": "stadium_mlb_spring_joker_marchant",
|
||||||
|
"valid_from": null,
|
||||||
|
"valid_until": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias_name": "tigertown",
|
||||||
|
"stadium_canonical_id": "stadium_mlb_spring_joker_marchant",
|
||||||
|
"valid_from": null,
|
||||||
|
"valid_until": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias_name": "las vegas ballpark",
|
||||||
|
"stadium_canonical_id": "stadium_mlb_las_vegas_ballpark",
|
||||||
|
"valid_from": null,
|
||||||
|
"valid_until": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias_name": "vegas ballpark",
|
||||||
|
"stadium_canonical_id": "stadium_mlb_las_vegas_ballpark",
|
||||||
|
"valid_from": null,
|
||||||
|
"valid_until": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias_name": "estadio alfredo harp helu",
|
||||||
|
"stadium_canonical_id": "stadium_mlb_mexico_alfredo_harp_helu",
|
||||||
|
"valid_from": null,
|
||||||
|
"valid_until": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias_name": "alfredo harp helu",
|
||||||
|
"stadium_canonical_id": "stadium_mlb_mexico_alfredo_harp_helu",
|
||||||
|
"valid_from": null,
|
||||||
|
"valid_until": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias_name": "diablos rojos stadium",
|
||||||
|
"stadium_canonical_id": "stadium_mlb_mexico_alfredo_harp_helu",
|
||||||
|
"valid_from": null,
|
||||||
|
"valid_until": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias_name": "mexico city stadium",
|
||||||
|
"stadium_canonical_id": "stadium_mlb_mexico_alfredo_harp_helu",
|
||||||
|
"valid_from": null,
|
||||||
|
"valid_until": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias_name": "field of dreams",
|
||||||
|
"stadium_canonical_id": "stadium_mlb_field_of_dreams",
|
||||||
|
"valid_from": null,
|
||||||
|
"valid_until": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias_name": "dyersville",
|
||||||
|
"stadium_canonical_id": "stadium_mlb_field_of_dreams",
|
||||||
|
"valid_from": null,
|
||||||
|
"valid_until": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias_name": "journey bank ballpark",
|
||||||
|
"stadium_canonical_id": "stadium_mlb_journey_bank_ballpark",
|
||||||
|
"valid_from": null,
|
||||||
|
"valid_until": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias_name": "bb&t ballpark williamsport",
|
||||||
|
"stadium_canonical_id": "stadium_mlb_journey_bank_ballpark",
|
||||||
|
"valid_from": null,
|
||||||
|
"valid_until": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias_name": "williamsport ballpark",
|
||||||
|
"stadium_canonical_id": "stadium_mlb_journey_bank_ballpark",
|
||||||
|
"valid_from": null,
|
||||||
|
"valid_until": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias_name": "little league classic",
|
||||||
|
"stadium_canonical_id": "stadium_mlb_journey_bank_ballpark",
|
||||||
|
"valid_from": null,
|
||||||
|
"valid_until": null
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -121,6 +121,7 @@ final class CanonicalStadium {
|
|||||||
var yearOpened: Int?
|
var yearOpened: Int?
|
||||||
var imageURL: String?
|
var imageURL: String?
|
||||||
var sport: String
|
var sport: String
|
||||||
|
var timezoneIdentifier: String?
|
||||||
|
|
||||||
// User-correctable fields (preserved during sync)
|
// User-correctable fields (preserved during sync)
|
||||||
var userNickname: String?
|
var userNickname: String?
|
||||||
@@ -145,7 +146,8 @@ final class CanonicalStadium {
|
|||||||
capacity: Int,
|
capacity: Int,
|
||||||
yearOpened: Int? = nil,
|
yearOpened: Int? = nil,
|
||||||
imageURL: String? = nil,
|
imageURL: String? = nil,
|
||||||
sport: String
|
sport: String,
|
||||||
|
timezoneIdentifier: String? = nil
|
||||||
) {
|
) {
|
||||||
self.canonicalId = canonicalId
|
self.canonicalId = canonicalId
|
||||||
self.uuid = uuid ?? Self.deterministicUUID(from: canonicalId)
|
self.uuid = uuid ?? Self.deterministicUUID(from: canonicalId)
|
||||||
@@ -161,6 +163,7 @@ final class CanonicalStadium {
|
|||||||
self.yearOpened = yearOpened
|
self.yearOpened = yearOpened
|
||||||
self.imageURL = imageURL
|
self.imageURL = imageURL
|
||||||
self.sport = sport
|
self.sport = sport
|
||||||
|
self.timezoneIdentifier = timezoneIdentifier
|
||||||
}
|
}
|
||||||
|
|
||||||
var source: DataSource {
|
var source: DataSource {
|
||||||
@@ -181,7 +184,8 @@ final class CanonicalStadium {
|
|||||||
capacity: capacity,
|
capacity: capacity,
|
||||||
sport: Sport(rawValue: sport) ?? .mlb,
|
sport: Sport(rawValue: sport) ?? .mlb,
|
||||||
yearOpened: yearOpened,
|
yearOpened: yearOpened,
|
||||||
imageURL: imageURL.flatMap { URL(string: $0) }
|
imageURL: imageURL.flatMap { URL(string: $0) },
|
||||||
|
timeZoneIdentifier: timezoneIdentifier
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ actor BootstrapService {
|
|||||||
let sport: String
|
let sport: String
|
||||||
let primary_team_abbrevs: [String]
|
let primary_team_abbrevs: [String]
|
||||||
let year_opened: Int?
|
let year_opened: Int?
|
||||||
|
let timezone_identifier: String?
|
||||||
}
|
}
|
||||||
|
|
||||||
private struct JSONCanonicalTeam: Codable {
|
private struct JSONCanonicalTeam: Codable {
|
||||||
@@ -71,7 +72,7 @@ actor BootstrapService {
|
|||||||
let away_team_canonical_id: String
|
let away_team_canonical_id: String
|
||||||
let stadium_canonical_id: String
|
let stadium_canonical_id: String
|
||||||
let is_playoff: Bool
|
let is_playoff: Bool
|
||||||
let broadcast: String?
|
let broadcast_info: String?
|
||||||
}
|
}
|
||||||
|
|
||||||
private struct JSONStadiumAlias: Codable {
|
private struct JSONStadiumAlias: Codable {
|
||||||
@@ -214,7 +215,8 @@ actor BootstrapService {
|
|||||||
longitude: jsonStadium.longitude,
|
longitude: jsonStadium.longitude,
|
||||||
capacity: jsonStadium.capacity,
|
capacity: jsonStadium.capacity,
|
||||||
yearOpened: jsonStadium.year_opened,
|
yearOpened: jsonStadium.year_opened,
|
||||||
sport: jsonStadium.sport
|
sport: jsonStadium.sport,
|
||||||
|
timezoneIdentifier: jsonStadium.timezone_identifier
|
||||||
)
|
)
|
||||||
context.insert(canonical)
|
context.insert(canonical)
|
||||||
}
|
}
|
||||||
@@ -437,7 +439,7 @@ actor BootstrapService {
|
|||||||
sport: jsonGame.sport,
|
sport: jsonGame.sport,
|
||||||
season: jsonGame.season,
|
season: jsonGame.season,
|
||||||
isPlayoff: jsonGame.is_playoff,
|
isPlayoff: jsonGame.is_playoff,
|
||||||
broadcastInfo: jsonGame.broadcast
|
broadcastInfo: jsonGame.broadcast_info
|
||||||
)
|
)
|
||||||
context.insert(game)
|
context.insert(game)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user