fix: resolve travel anchor ID collision for repeat city pairs
Include segment index in travel anchor IDs ("travel:INDEX:from->to")
so Follow Team trips visiting the same city pair multiple times get
unique, independently addressable travel segments. Prevents override
dictionary collisions and incorrect validDayRange lookups.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -38,6 +38,7 @@ enum ItemKind: Codable, Hashable {
|
||||
struct TravelInfo: Codable, Hashable {
|
||||
let fromCity: String
|
||||
let toCity: String
|
||||
var segmentIndex: Int? = nil // Position in trip.travelSegments (nil for legacy records)
|
||||
var distanceMeters: Double?
|
||||
var durationSeconds: Double?
|
||||
|
||||
|
||||
@@ -155,6 +155,7 @@ extension ItineraryItem {
|
||||
let info = TravelInfo(
|
||||
fromCity: fromCity,
|
||||
toCity: toCity,
|
||||
segmentIndex: record["travelSegmentIndex"] as? Int,
|
||||
distanceMeters: record["travelDistanceMeters"] as? Double,
|
||||
durationSeconds: record["travelDurationSeconds"] as? Double
|
||||
)
|
||||
@@ -198,6 +199,7 @@ extension ItineraryItem {
|
||||
record["kind"] = "travel"
|
||||
record["travelFromCity"] = info.fromCity
|
||||
record["travelToCity"] = info.toCity
|
||||
record["travelSegmentIndex"] = info.segmentIndex
|
||||
record["travelDistanceMeters"] = info.distanceMeters
|
||||
record["travelDurationSeconds"] = info.durationSeconds
|
||||
|
||||
|
||||
Reference in New Issue
Block a user