commit wip

This commit is contained in:
Joaquin Ossa 2025-02-12 09:07:47 +01:00
parent 78707ef649
commit 83e8723d7d
2 changed files with 41 additions and 2 deletions

View file

@ -76,6 +76,10 @@ vars:
"cancelled_booking_state": "'CANCELLED'"
"approved_booking_state": "'APPROVED'"
"flagged_booking_state": "'FLAGGED'"
"incomplete_information_booking_state": "'INCOMPLETE INFORMATION'"
"no_flags_booking_state": "'NO FLAGS'"
"not_approved_booking_state": "'NOT APPROVED'"
"rejected_booking_state": "'REJECTED'"
# Payment state variables
# States should be strings in capital letters. Models need to force an upper()

View file

@ -96,7 +96,38 @@ with
then bpb.id_booking
else null
end
) as number_flagged_bookings
) as number_flagged_bookings,
count(
distinct case
when
upper(b.booking_state)
= {{ var("incomplete_information_booking_state") }}
then bpb.id_booking
else null
end
) as incomplete_information_bookings,
count(
distinct case
when upper(b.booking_state) = {{ var("no_flags_booking_state") }}
then bpb.id_booking
else null
end
) as no_flags_bookings,
count(
distinct case
when
upper(b.booking_state) = {{ var("not_approved_booking_state") }}
then bpb.id_booking
else null
end
) as not_approved_bookings,
count(
distinct case
when upper(b.booking_state) = {{ var("rejected_booking_state") }}
then bpb.id_booking
else null
end
) as rejected_bookings
from bundle_services bs
left join
int_core__booking_to_product_bundle bpb
@ -116,7 +147,11 @@ select
b.number_bookings,
b.number_approved_bookings,
b.number_cancelled_bookings,
b.number_flagged_bookings
b.number_flagged_bookings,
b.incomplete_information_bookings,
b.no_flags_bookings,
b.not_approved_bookings,
b.rejected_bookings
from users u
left join accommodations a on u.service_display_name = a.service_display_name
left join bookings b on u.service_display_name = b.service_display_name