guesty_verifications model

This commit is contained in:
Joaquin Ossa 2024-09-05 17:21:48 +02:00
parent 4322206091
commit 7036b24847
4 changed files with 17 additions and 8 deletions

View file

@ -8,18 +8,18 @@ with
select
v.id_verification,
v.id_booking,
v.verification_status,
v.is_cancelled,
-- when number_nights = 0 (booking's checkin and checkout are on the same day)
-- it's charged for just 1 night
case
when v.number_nights = 0
when v.number_nights = 0 and v.verification_status = '{{ ok_status }}'
then {{ cost_per_night }}
else v.number_nights * {{ cost_per_night }}
when v.verification_status = '{{ ok_status }}'
then v.number_nights * {{ cost_per_night }}
else 0
end as ok_status_fee_in_gbp,
v.created_date_utc,
v.checkout_date_utc
from int_edeposit__verifications v
where
v.version = 'V1'
and v.verification_status = '{{ ok_status }}'
and v.id_booking is not null
where v.version = 'V1' and v.id_booking is not null