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:
Bianca Widstam
2025-09-24 08:50:30 +00:00
parent 490013be62
commit aa99a5d4f6
4 changed files with 56 additions and 9 deletions

View File

@@ -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
})