feat: SW-1588 Optimized code & comments

This commit is contained in:
Hrishikesh Vaipurkar
2025-02-20 12:03:26 +01:00
parent b0f6fa7e45
commit 8b53ed3301
3 changed files with 12 additions and 4 deletions

View File

@@ -63,6 +63,11 @@ export default function PriceList({
nights, nights,
}) })
// When it is Promotion rate either booking code rate or public
// Show striked Regular rate which is overtaken by the Promotional rate when member rate is not available
const showOvertakingPrice =
!memberLocalPrice && publicLocalPrice.regularPricePerNight
return ( return (
<dl className={styles.priceList}> <dl className={styles.priceList}>
{isUserLoggedIn && isMainRoom && memberLocalPrice ? null : ( {isUserLoggedIn && isMainRoom && memberLocalPrice ? null : (
@@ -129,7 +134,7 @@ export default function PriceList({
</dd> </dd>
</div> </div>
)} )}
{publicLocalPrice.regularPricePerNight && ( {showOvertakingPrice && (
<div className={styles.priceRow}> <div className={styles.priceRow}>
<dt></dt> <dt></dt>
<dd> <dd>

View File

@@ -34,8 +34,8 @@ export default function RoomSelectionPanel() {
(state) => state.activeCodeFilter (state) => state.activeCodeFilter
) )
// With Booking code rates we will always obtain public rate and never a member rate, // Regular Rates (Save, Change and Flex) always should send both public and member rates
// so we should ignore it from the logic below. // so we can check public rates for availability
const isRegularRatesAvailableWithCode = const isRegularRatesAvailableWithCode =
bookingCode && bookingCode &&
rooms.some( rooms.some(
@@ -49,6 +49,8 @@ export default function RoomSelectionPanel() {
// Booking codes rate comes with various rate types but Regular is reserved // Booking codes rate comes with various rate types but Regular is reserved
// for non-booking code rates (Save, Change & Flex) // for non-booking code rates (Save, Change & Flex)
// With Booking code rates we will always obtain public rate and maybe a member rate
// so we check for public rate and ignore member rate
const isBookingCodeRatesAvailable = const isBookingCodeRatesAvailable =
bookingCode && bookingCode &&
rooms.some( rooms.some(

View File

@@ -44,7 +44,8 @@ export const roomConfigurationSchema = z
return product return product
} }
// Return rate even if single when booking code rate which can be any one of other rate types // Return rate with only public available when it is a booking code rate
// which can be any one of other rate types
if (product.productType.public.rateType !== RateTypeEnum.Regular) { if (product.productType.public.rateType !== RateTypeEnum.Regular) {
return product return product
} }