fix(itinerary): add city to game items for proper constraint validation
Travel constraint validation was not working because ItineraryConstraints had no game items to validate against - games came from RichGame objects but were never converted to ItineraryItem for constraint checking. Changes: - Add city parameter to ItemKind.game enum case - Create game ItineraryItems from RichGame data in buildItineraryData() - Update isValidTravelPosition to compare against actual game sortOrders - Fix tests to use appropriate game sortOrder conventions Now travel is properly constrained to appear before arrival city games and after departure city games. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -388,11 +388,9 @@ final class PDFGenerator {
|
||||
var primaryCity: String?
|
||||
for item in items {
|
||||
switch item.kind {
|
||||
case .game(let gameId):
|
||||
if let richGame = games[gameId] {
|
||||
primaryCity = richGame.stadium.city
|
||||
break
|
||||
}
|
||||
case .game(_, let city):
|
||||
primaryCity = city
|
||||
break
|
||||
case .travel(let info):
|
||||
primaryCity = info.toCity
|
||||
break
|
||||
@@ -419,7 +417,7 @@ final class PDFGenerator {
|
||||
var hasContent = false
|
||||
for item in items {
|
||||
switch item.kind {
|
||||
case .game(let gameId):
|
||||
case .game(let gameId, _):
|
||||
if let richGame = games[gameId] {
|
||||
currentY = drawGameCard(
|
||||
context: context,
|
||||
|
||||
Reference in New Issue
Block a user