fix: make sure calculations in booking flow are correct

This commit is contained in:
Simon Emanuelsson
2025-04-02 15:49:59 +02:00
committed by Michael Zetterberg
parent 3e0f503314
commit a222ecfc5c
28 changed files with 309 additions and 276 deletions

View File

@@ -71,6 +71,7 @@ export function createRatesStore({
const roomConfiguration = roomConfigurations?.[idx]
const selectedRoom = findSelectedRate(
room.rateCode,
room.counterRateCode,
room.roomTypeCode,
roomConfiguration
)
@@ -79,7 +80,11 @@ export function createRatesStore({
continue
}
const product = findProductInRoom(room.rateCode, selectedRoom)
const product = findProductInRoom(
room.rateCode,
selectedRoom,
room.counterRateCode
)
if (product) {
rateSummary[idx] = {
features: selectedRoom.features,
@@ -121,13 +126,18 @@ export function createRatesStore({
const selectedRate =
findSelectedRate(
room.rateCode,
room.counterRateCode,
room.roomTypeCode,
roomConfiguration
) ?? null
let product = null
if (selectedRate) {
product = findProductInRoom(room.rateCode, selectedRate)
product = findProductInRoom(
room.rateCode,
selectedRate,
room.counterRateCode
)
}
// Since features are fetched async based on query string, we need to read from query string to apply correct filtering