Merged in fix/BOOK-130-booking-code-filtering (pull request #2868)
fix(BOOK-130): update booking code filtering on map view and filter and sort modal * fix(BOOK-130): update booking code filtering on map view and filter and sort modal * fix(BOOK-130): change name of filteredIds * fix(BOOK-130): add initial value reduce Approved-by: Joakim Jäderberg Approved-by: Anton Gunnarsson
This commit is contained in:
@@ -292,7 +292,8 @@ const hotelFacilitiesFilterNames = [
|
||||
]
|
||||
|
||||
export function getFiltersFromHotels(
|
||||
hotels: HotelResponse[]
|
||||
hotels: HotelResponse[],
|
||||
showBookingCodeFilter: boolean
|
||||
): CategorizedHotelFilters {
|
||||
const defaultFilters = { facilityFilters: [], surroundingsFilters: [] }
|
||||
if (!hotels.length) {
|
||||
@@ -306,7 +307,10 @@ export function getFiltersFromHotels(
|
||||
...facility,
|
||||
hotelId: hotel.operaId,
|
||||
hotelIds: [hotel.operaId],
|
||||
filteredIds: availability.bookingCode ? [hotel.operaId] : [],
|
||||
bookingCodeFilteredIds:
|
||||
availability.bookingCode || !showBookingCodeFilter
|
||||
? [hotel.operaId]
|
||||
: [],
|
||||
}
|
||||
)
|
||||
)
|
||||
@@ -321,8 +325,10 @@ export function getFiltersFromHotels(
|
||||
const matchingFilters = filters.filter((f) => f.id === filterId)
|
||||
|
||||
filter.hotelIds = matchingFilters.map((f) => f.hotelId)
|
||||
filter.filteredIds = [
|
||||
...new Set(matchingFilters.flatMap((f) => f.filteredIds ?? [])),
|
||||
filter.bookingCodeFilteredIds = [
|
||||
...new Set(
|
||||
matchingFilters.flatMap((f) => f.bookingCodeFilteredIds ?? [])
|
||||
),
|
||||
]
|
||||
}
|
||||
return filter
|
||||
|
||||
Reference in New Issue
Block a user