feat: SW-1588 Optimized code & comments
This commit is contained in:
@@ -63,6 +63,11 @@ export default function PriceList({
|
||||
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 (
|
||||
<dl className={styles.priceList}>
|
||||
{isUserLoggedIn && isMainRoom && memberLocalPrice ? null : (
|
||||
@@ -129,7 +134,7 @@ export default function PriceList({
|
||||
</dd>
|
||||
</div>
|
||||
)}
|
||||
{publicLocalPrice.regularPricePerNight && (
|
||||
{showOvertakingPrice && (
|
||||
<div className={styles.priceRow}>
|
||||
<dt></dt>
|
||||
<dd>
|
||||
|
||||
@@ -34,8 +34,8 @@ export default function RoomSelectionPanel() {
|
||||
(state) => state.activeCodeFilter
|
||||
)
|
||||
|
||||
// With Booking code rates we will always obtain public rate and never a member rate,
|
||||
// so we should ignore it from the logic below.
|
||||
// Regular Rates (Save, Change and Flex) always should send both public and member rates
|
||||
// so we can check public rates for availability
|
||||
const isRegularRatesAvailableWithCode =
|
||||
bookingCode &&
|
||||
rooms.some(
|
||||
@@ -49,6 +49,8 @@ export default function RoomSelectionPanel() {
|
||||
|
||||
// Booking codes rate comes with various rate types but Regular is reserved
|
||||
// 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 =
|
||||
bookingCode &&
|
||||
rooms.some(
|
||||
|
||||
@@ -44,7 +44,8 @@ export const roomConfigurationSchema = z
|
||||
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) {
|
||||
return product
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user