Merged in fix/SW-3083-alternative-hotels-page-not-found (pull request #2396)

fix(SW-3083): alternative hotels compare locations with cityIdentifier

* fix(SW-3083): alternative hotels compare locations with cityIdentifier

* fix(SW-3083): rename cityName

* fix(SW-3083): rename to cityIdentifier


Approved-by: Anton Gunnarsson
This commit is contained in:
Bianca Widstam
2025-06-19 08:08:33 +00:00
parent 1cc2bc70c1
commit 46e7f33ab6
4 changed files with 13 additions and 12 deletions

View File

@@ -24,7 +24,7 @@ interface HotelSearchDetails {
childrenInRoom: ChildrenInRoom
childrenInRoomString: ChildrenInRoomString
city: Location | null
cityName: string | undefined
cityIdentifier: string | undefined
hotel: HotelLocation | null
noOfRooms: number
redemption?: boolean
@@ -61,15 +61,16 @@ export async function getHotelSearchDetails(
return notFound()
}
const cityName = isAlternativeHotels
? hotel?.relationships.city.name
const cityIdentifier = isAlternativeHotels
? hotel?.relationships.city.cityIdentifier
: params.city
const city = cityName
const city = cityIdentifier
? (locations.find(
(location) =>
"cityIdentifier" in location &&
location.cityIdentifier?.toLowerCase() === cityName.toLowerCase()
location.cityIdentifier?.toLowerCase() ===
cityIdentifier.toLowerCase()
) ?? null)
: null
@@ -97,7 +98,7 @@ export async function getHotelSearchDetails(
childrenInRoom,
childrenInRoomString,
city,
cityName,
cityIdentifier,
hotel,
noOfRooms: rooms?.length ?? 0,
redemption: params.searchType === REDEMPTION,