Added a coalesce for the booking_fee_in_gbp calculation for old cases where there is no preferred currency for the user_guest

This commit is contained in:
Joaquin Ossa 2024-08-01 16:15:48 +02:00
parent 25e657014a
commit 02ddac3167

View file

@ -8,7 +8,8 @@ with
select * from {{ ref("int_core__duplicate_bookings") }}
),
int_core__unified_user as (select * from {{ ref("int_core__unified_user") }}),
int_simple_exchange_rates as (select * from {{ ref("int_simple_exchange_rates") }})
int_simple_exchange_rates as (select * from {{ ref("int_simple_exchange_rates") }}),
stg_core__country as (select * from {{ ref("stg_core__country") }}),
select
b.id_booking,
b.id_user_guest,
@ -18,7 +19,9 @@ select
coalesce(db.is_duplicate_booking, false) as is_duplicate_booking,
bce.booking_fee_local,
uu.account_currency_iso4217,
ser.rate * bce.booking_fee_local as booking_fee_in_gbp,
coalesce(
ser.rate * bce.booking_fee_local, bce.booking_fee_local
) as booking_fee_in_gbp,
bce.booking_fee_charge_at_utc,
bce.booking_fee_charge_date_utc
from stg_core__booking b