Stabilize beta release with warning cleanup and edge-case fixes
This commit is contained in:
@@ -569,7 +569,19 @@ final class CanonicalSyncService {
|
||||
var skippedOlder = 0
|
||||
|
||||
for remoteStructure in remoteStructures {
|
||||
let result = try mergeLeagueStructure(remoteStructure, context: context)
|
||||
let structureType = LeagueStructureType(rawValue: remoteStructure.structureTypeRaw.lowercased()) ?? .division
|
||||
let model = LeagueStructureModel(
|
||||
id: remoteStructure.id,
|
||||
sport: remoteStructure.sport,
|
||||
structureType: structureType,
|
||||
name: remoteStructure.name,
|
||||
abbreviation: remoteStructure.abbreviation,
|
||||
parentId: remoteStructure.parentId,
|
||||
displayOrder: remoteStructure.displayOrder,
|
||||
schemaVersion: remoteStructure.schemaVersion,
|
||||
lastModified: remoteStructure.lastModified
|
||||
)
|
||||
let result = try mergeLeagueStructure(model, context: context)
|
||||
|
||||
switch result {
|
||||
case .applied: updated += 1
|
||||
@@ -593,7 +605,18 @@ final class CanonicalSyncService {
|
||||
var skippedOlder = 0
|
||||
|
||||
for remoteAlias in remoteAliases {
|
||||
let result = try mergeTeamAlias(remoteAlias, context: context)
|
||||
let aliasType = TeamAliasType(rawValue: remoteAlias.aliasTypeRaw.lowercased()) ?? .name
|
||||
let model = TeamAlias(
|
||||
id: remoteAlias.id,
|
||||
teamCanonicalId: remoteAlias.teamCanonicalId,
|
||||
aliasType: aliasType,
|
||||
aliasValue: remoteAlias.aliasValue,
|
||||
validFrom: remoteAlias.validFrom,
|
||||
validUntil: remoteAlias.validUntil,
|
||||
schemaVersion: remoteAlias.schemaVersion,
|
||||
lastModified: remoteAlias.lastModified
|
||||
)
|
||||
let result = try mergeTeamAlias(model, context: context)
|
||||
|
||||
switch result {
|
||||
case .applied: updated += 1
|
||||
@@ -617,7 +640,15 @@ final class CanonicalSyncService {
|
||||
var skippedOlder = 0
|
||||
|
||||
for remoteAlias in remoteAliases {
|
||||
let result = try mergeStadiumAlias(remoteAlias, context: context)
|
||||
let model = StadiumAlias(
|
||||
aliasName: remoteAlias.aliasName,
|
||||
stadiumCanonicalId: remoteAlias.stadiumCanonicalId,
|
||||
validFrom: remoteAlias.validFrom,
|
||||
validUntil: remoteAlias.validUntil,
|
||||
schemaVersion: remoteAlias.schemaVersion,
|
||||
lastModified: remoteAlias.lastModified
|
||||
)
|
||||
let result = try mergeStadiumAlias(model, context: context)
|
||||
|
||||
switch result {
|
||||
case .applied: updated += 1
|
||||
@@ -641,7 +672,20 @@ final class CanonicalSyncService {
|
||||
var skippedOlder = 0
|
||||
|
||||
for remoteSport in remoteSports {
|
||||
let result = try mergeSport(remoteSport, context: context)
|
||||
let model = CanonicalSport(
|
||||
id: remoteSport.id,
|
||||
abbreviation: remoteSport.abbreviation,
|
||||
displayName: remoteSport.displayName,
|
||||
iconName: remoteSport.iconName,
|
||||
colorHex: remoteSport.colorHex,
|
||||
seasonStartMonth: remoteSport.seasonStartMonth,
|
||||
seasonEndMonth: remoteSport.seasonEndMonth,
|
||||
isActive: remoteSport.isActive,
|
||||
lastModified: remoteSport.lastModified,
|
||||
schemaVersion: remoteSport.schemaVersion,
|
||||
source: .cloudKit
|
||||
)
|
||||
let result = try mergeSport(model, context: context)
|
||||
|
||||
switch result {
|
||||
case .applied: updated += 1
|
||||
|
||||
Reference in New Issue
Block a user