Merged in fix/BOOK-130-filter-booking-code-count (pull request #2856)
fix(BOOK-130): update filter counts when using booking code * fix(BOOK-130): update filter counts when using booking code * fix(BOOK-130): change message Approved-by: Erik Tiekstra Approved-by: Matilda Landström
This commit is contained in:
@@ -299,13 +299,14 @@ export function getFiltersFromHotels(
|
||||
return defaultFilters
|
||||
}
|
||||
|
||||
const filters = hotels.flatMap(({ hotel }) =>
|
||||
const filters = hotels.flatMap(({ hotel, availability }) =>
|
||||
hotel.detailedFacilities.map(
|
||||
(facility) =>
|
||||
<HotelFilter>{
|
||||
...facility,
|
||||
hotelId: hotel.operaId,
|
||||
hotelIds: [hotel.operaId],
|
||||
filteredIds: availability.bookingCode ? [hotel.operaId] : [],
|
||||
}
|
||||
)
|
||||
)
|
||||
@@ -317,9 +318,12 @@ export function getFiltersFromHotels(
|
||||
|
||||
// List and include all hotel Ids having same filter / amenity
|
||||
if (filter) {
|
||||
filter.hotelIds = filters
|
||||
.filter((f) => f.id === filterId)
|
||||
.map((f) => f.hotelId)
|
||||
const matchingFilters = filters.filter((f) => f.id === filterId)
|
||||
|
||||
filter.hotelIds = matchingFilters.map((f) => f.hotelId)
|
||||
filter.filteredIds = [
|
||||
...new Set(matchingFilters.flatMap((f) => f.filteredIds ?? [])),
|
||||
]
|
||||
}
|
||||
return filter
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user