Merged in feat/SW-1308-booking-codes-track-b (pull request #1607)

Feat/SW-1308 booking codes track b

* feat: SW-1308 Booking codes track b

* feat: SW-1308 Booking codes Track B implementation

* feat: SW-1308 Optimized after rebase


Approved-by: Arvid Norlin
This commit is contained in:
Hrishikesh Vaipurkar
2025-03-24 11:23:11 +00:00
parent 5643bcc62a
commit b0674d07f5
66 changed files with 1612 additions and 285 deletions

View File

@@ -1,4 +1,5 @@
import { SortOrder } from "@/types/components/hotelReservation/selectHotel/hotelSorter"
import { RateTypeEnum } from "@/types/enums/rateType"
import type { HotelResponse } from "@/components/HotelReservation/SelectHotel/helpers"
function getPricePerNight(hotel: HotelResponse): number {
@@ -47,23 +48,21 @@ export function getSortedHotels({
sortingStrategies[sortBy] ?? sortingStrategies[SortOrder.Distance]
if (bookingCode) {
const bookingCodeHotels = hotels.filter(
const bookingCodeRateHotels = availableHotels.filter(
(hotel) =>
(hotel.availability.productType?.public?.rateType?.toLowerCase() !==
"regular" ||
hotel.availability.productType?.member?.rateType?.toLowerCase() !==
"regular") &&
(hotel.availability.productType?.public?.rateType !== RateTypeEnum.Regular &&
hotel.availability.productType?.member?.rateType !== RateTypeEnum.Regular) &&
!!hotel.availability.productType
)
const regularHotels = hotels.filter(
const regularRateHotels = availableHotels.filter(
(hotel) =>
hotel.availability.productType?.public?.rateType?.toLowerCase() ===
"regular"
hotel.availability.productType?.public?.rateType === RateTypeEnum.Regular ||
hotel?.availability.productType?.member?.rateType === RateTypeEnum.Regular
)
return bookingCodeHotels
return bookingCodeRateHotels
.sort(sortStrategy)
.concat(regularHotels.sort(sortStrategy))
.concat(regularRateHotels.sort(sortStrategy))
.concat(unavailableHotels.sort(sortStrategy))
}