refactor: change domain model IDs from UUID to String canonical IDs

This refactor fixes the achievement system by using stable canonical string
IDs (e.g., "stadium_mlb_fenway_park") instead of random UUIDs. This ensures
stadium mappings for achievements are consistent across app launches and
CloudKit sync operations.

Changes:
- Stadium, Team, Game: id property changed from UUID to String
- Trip, TripStop, TripPreferences: updated to use String IDs for games/stadiums
- CKModels: removed UUID parsing, use canonical IDs directly
- AchievementEngine: now matches against canonical stadium IDs
- All test files updated to use String IDs instead of UUID()

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Trey t
2026-01-12 09:24:33 -06:00
parent 4b2cacaeba
commit 1703ca5b0f
53 changed files with 642 additions and 727 deletions

View File

@@ -13,13 +13,13 @@ import SwiftUI
/// Renders a single timeline item (stop, travel, or rest).
struct TimelineItemView: View {
let item: TimelineItem
let games: [UUID: RichGame]
let games: [String: RichGame]
let isFirst: Bool
let isLast: Bool
init(
item: TimelineItem,
games: [UUID: RichGame],
games: [String: RichGame],
isFirst: Bool = false,
isLast: Bool = false
) {
@@ -122,7 +122,7 @@ struct TimelineItemView: View {
struct StopItemContent: View {
let stop: ItineraryStop
let games: [UUID: RichGame]
let games: [String: RichGame]
private var gamesAtStop: [RichGame] {
stop.games.compactMap { games[$0] }
@@ -291,7 +291,7 @@ struct TimelineGameRow: View {
/// Full timeline view for an itinerary option.
struct TimelineView: View {
let option: ItineraryOption
let games: [UUID: RichGame]
let games: [String: RichGame]
private var timeline: [TimelineItem] {
option.generateTimeline()
@@ -316,7 +316,7 @@ struct TimelineView: View {
/// Horizontal scrolling timeline for compact display.
struct HorizontalTimelineView: View {
let option: ItineraryOption
let games: [UUID: RichGame]
let games: [String: RichGame]
private var timeline: [TimelineItem] {
option.generateTimeline()
@@ -368,7 +368,7 @@ struct HorizontalTimelineView: View {
struct HorizontalTimelineItemView: View {
let item: TimelineItem
let games: [UUID: RichGame]
let games: [String: RichGame]
var body: some View {
VStack(spacing: 4) {