Changed model for bookings with 0 nights
This commit is contained in:
parent
81f57e0b5a
commit
920f6f7e51
3 changed files with 11 additions and 80 deletions
|
|
@ -1,82 +1,6 @@
|
||||||
{% set ok_status = "Approved" %}
|
{% set ok_status = "Approved" %}
|
||||||
-- 2GBP/booked night if booking is approved, to be charged on checkout
|
-- 2GBP/booked night if booking is approved, to be charged on checkout
|
||||||
{% set cost_per_night = 2 %}
|
{% set cost_per_night = 2 %}
|
||||||
-- verifications for bookings of 0 nights length (free verifications)
|
|
||||||
{% set zero_nights_verifications = (
|
|
||||||
"1e2_IdjTfE-5-63wsVvsLw",
|
|
||||||
"1eyQxaOrik-tDDY-50yETw",
|
|
||||||
"2QsxYXnp8Eqt9LvwF-RjQA",
|
|
||||||
"3EwjbURya0CBcXPNiNd4AQ",
|
|
||||||
"3HTQjfd8UEaQuOBjSM4r4A",
|
|
||||||
"44kyxquKfEepksOaD3EkBA",
|
|
||||||
"4kFxvTnhVkSITKCAsC_EcA",
|
|
||||||
"5lmGMd2BMkSZWI-V1pMYQQ",
|
|
||||||
"7Hcc3tvcw0G-yUs4TDdDUA",
|
|
||||||
"7KkmuwFMfUmNxhhGkvesJQ",
|
|
||||||
"8aQ48W3lWEGFOMJ6p-fbMA",
|
|
||||||
"8XeRk5xhWkan_qWJY1f2lA",
|
|
||||||
"8Y0Yt927Rk22O7PDIOytnw",
|
|
||||||
"9Hz0ortDMUuXqoGHvv6abg",
|
|
||||||
"a5bCsG937U6Z3yK9dMjrpA",
|
|
||||||
"ackyLdyBrkC5artgEuKF4w",
|
|
||||||
"ApP1uSQMC0qTHlBt6FD5fA",
|
|
||||||
"aq6Jc-orvEOhMd7NRD7bqw",
|
|
||||||
"ATVxKzqCpkqdq_L1YZ2pmA",
|
|
||||||
"bZh2Y6wVbUytYP2LO8AN9A",
|
|
||||||
"CbiQTmAoiEWRqdyGy7G_sw",
|
|
||||||
"Dk1RUj8VYEWtH2o0SmST7w",
|
|
||||||
"doZ9bEUtF0a89zd2y-W3fA",
|
|
||||||
"E8Ja63GtoUiQnB-XVAmoDQ",
|
|
||||||
"evZyKAB8VEuILahLMIxbvQ",
|
|
||||||
"gDD04Xu0oUauqSmPXpp0Fg",
|
|
||||||
"GmF3HSUuBUmy5AW13Xp9uQ",
|
|
||||||
"GRNw1nCcOEamq-VzKTlgBA",
|
|
||||||
"H08FsxtIKE-0g3SmBKRJDg",
|
|
||||||
"hkquJggA2ESg1dgJxS4Qvg",
|
|
||||||
"iVE0CddyJUKcyQ0vHomjkw",
|
|
||||||
"Ji-bKUnbEUWu41uOaZZ7AA",
|
|
||||||
"jTmvoTGQvEOKXYMTSJkHcw",
|
|
||||||
"KEXvz4kCek2sHpkn1YQnTg",
|
|
||||||
"kIugOX7Xa0G0Ji-fbupJmQ",
|
|
||||||
"-kJtKe0ro0qJm5cJ3n4UJw",
|
|
||||||
"KYknhrUET0ezwMlGVnW5bA",
|
|
||||||
"L8J4vqxC3ku2Rl-JYISKcw",
|
|
||||||
"lfUz7LE0fEqnh3FQCCnr7w",
|
|
||||||
"lPAVUVnvC02S9Lk4KVJHoQ",
|
|
||||||
"MmEI1qRyW0yDvG1XAa2nXA",
|
|
||||||
"MRANOM0Nokyu-w5U217jGQ",
|
|
||||||
"NC6aoxHnaUGRnmP3eBqARA",
|
|
||||||
"nv3_ga2lZ0O0p_JAXg8GYw",
|
|
||||||
"Os-O0qdGuESgsI2NSyS9SQ",
|
|
||||||
"piu-gaC7wEyIVhq3oRwTvA",
|
|
||||||
"pvIEp8oI3069WJpXvIs6vw",
|
|
||||||
"QH4SEo6CwU6FZyZVFlInbw",
|
|
||||||
"qLWsWLSuokC6ErtOJEQ2gw",
|
|
||||||
"r-EfTfsrpEy0E3Z_zO7_Cg",
|
|
||||||
"rRDE-bleRUmGjQIhfIegiA",
|
|
||||||
"SdbeP3jDWku0s2KRXrPoTw",
|
|
||||||
"t8zbERNeo0S8A0fyuLiifQ",
|
|
||||||
"Ta22a2fewUC5XeIzBR-UbA",
|
|
||||||
"TMXcAl1_YUSn95citKZqWA",
|
|
||||||
"tqkrt7xWsEm10kO1dIX7Uw",
|
|
||||||
"tsWypIaf7Uyt9JnacY7hfw",
|
|
||||||
"txNanrgPi06rzn1zlhq6mQ",
|
|
||||||
"tZPMh6UAM06pbO5ilj1_ZQ",
|
|
||||||
"UbIXEWG02kOLtXy2YHOh7g",
|
|
||||||
"UHXtpZ-wkk6vKZsgRnSV0w",
|
|
||||||
"ujDpwnsj2EKOaTC-kcJlgw",
|
|
||||||
"uu8hI2o8F021mT6Sd9torQ",
|
|
||||||
"VJOEu3sK30mqE-TMx-rbGQ",
|
|
||||||
"vvu12dqmH0-ly6dN_mm8ZA",
|
|
||||||
"vxAGWHT3L0GWjvqn320DxA",
|
|
||||||
"wqydvtLFo0GGOwn-rMzQyQ",
|
|
||||||
"X2MZAlwNVUSmQO6__Y7Zyg",
|
|
||||||
"xfq-t4w0cUGQz5_MuOUlnw",
|
|
||||||
"Xht7NfpS50GinSKzzX_gQg",
|
|
||||||
"Y0EG8skyB0y105hz-ayTSQ",
|
|
||||||
"Y8LYI_4QE0W0ShG1jAVaDA",
|
|
||||||
"ZpbBtHGa2E6JaLgX1LsYLQ",
|
|
||||||
) %}
|
|
||||||
with
|
with
|
||||||
int_edeposit__verifications as (
|
int_edeposit__verifications as (
|
||||||
select * from {{ ref("int_edeposit__verifications") }}
|
select * from {{ ref("int_edeposit__verifications") }}
|
||||||
|
|
@ -85,7 +9,13 @@ select
|
||||||
v.id_verification,
|
v.id_verification,
|
||||||
v.id_booking,
|
v.id_booking,
|
||||||
v.is_cancelled,
|
v.is_cancelled,
|
||||||
v.number_nights * {{ cost_per_night }} as ok_status_fee_in_gbp,
|
-- 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
|
||||||
|
then {{ cost_per_night }}
|
||||||
|
else v.number_nights * {{ cost_per_night }}
|
||||||
|
end as ok_status_fee_in_gbp,
|
||||||
v.created_date_utc,
|
v.created_date_utc,
|
||||||
v.checkout_date_utc
|
v.checkout_date_utc
|
||||||
from int_edeposit__verifications v
|
from int_edeposit__verifications v
|
||||||
|
|
@ -93,4 +23,3 @@ where
|
||||||
v.version = 'V1'
|
v.version = 'V1'
|
||||||
and v.verification_status = '{{ ok_status }}'
|
and v.verification_status = '{{ ok_status }}'
|
||||||
and v.id_booking is not null
|
and v.id_booking is not null
|
||||||
and v.id_verification not in {{ zero_nights_verifications }}
|
|
||||||
|
|
|
||||||
|
|
@ -309,7 +309,8 @@ models:
|
||||||
- name: int_edeposit__guesty_verifications
|
- name: int_edeposit__guesty_verifications
|
||||||
description:
|
description:
|
||||||
"This table shows all verification for Guesty.
|
"This table shows all verification for Guesty.
|
||||||
The charged fee is 2GBP per booked night if booking is approved,
|
The charged fee is 2GBP per booked night if booking is approved
|
||||||
|
(considered 1 night when the checkin and checkout are on the same day),
|
||||||
to be charged on checkout."
|
to be charged on checkout."
|
||||||
columns:
|
columns:
|
||||||
- name: id_verification
|
- name: id_verification
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,8 @@ models:
|
||||||
- name: edeposit__guesty_verifications
|
- name: edeposit__guesty_verifications
|
||||||
description:
|
description:
|
||||||
"This table shows all verification for Guesty.
|
"This table shows all verification for Guesty.
|
||||||
The charged fee is 2GBP per booked night if booking is approved,
|
The charged fee is 2GBP per booked night if booking is approved
|
||||||
|
(considered 1 night when the checkin and checkout are on the same day),
|
||||||
to be charged on checkout."
|
to be charged on checkout."
|
||||||
columns:
|
columns:
|
||||||
- name: id_verification
|
- name: id_verification
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue