Merged PR 4360: Added all booking states

# Description

Included all booking states in the model.
At first I thought I would only show the most relevant but better to show all of them so the total adds up

# Checklist

- [x] The edited models and dependants run properly with production data.
- [x] The edited models are sufficiently documented.
- [x] The edited models contain PK tests, and I've ran and passed them.
- [ ] I have checked for DRY opportunities with other models and docs.
- [ ] I've picked the right materialization for the affected models.

# Other

- [ ] Check if a full-refresh is required after this PR is merged.

Related work items: #25934
This commit is contained in:
Joaquin Ossa 2025-02-12 08:26:25 +00:00
commit 0aca860f29
5 changed files with 96 additions and 3 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 number_incomplete_information_bookings,
count(
distinct case
when upper(b.booking_state) = {{ var("no_flags_booking_state") }}
then bpb.id_booking
else null
end
) as number_no_flags_bookings,
count(
distinct case
when
upper(b.booking_state) = {{ var("not_approved_booking_state") }}
then bpb.id_booking
else null
end
) as number_not_approved_bookings,
count(
distinct case
when upper(b.booking_state) = {{ var("rejected_booking_state") }}
then bpb.id_booking
else null
end
) as number_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.number_incomplete_information_bookings,
b.number_no_flags_bookings,
b.number_not_approved_bookings,
b.number_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

View file

@ -5302,6 +5302,31 @@ models:
description:
"Number of bookings that have a bundle that considers this service and
are flagged."
- name: number_incomplete_information_bookings
data_type: bigint
description:
"Number of bookings that have a bundle that considers this service and
have incomplete information."
- name: number_no_flags_bookings
data_type: bigint
description:
"Number of bookings that have a bundle that considers this service and
have no flags."
- name: number_not_approved_bookings
data_type: bigint
description:
"Number of bookings that have a bundle that considers this service and
are not approved."
- name: number_rejected_bookings
data_type: bigint
description:
"Number of bookings that have a bundle that considers this service and
are rejected."
- name: int_core__payments
description: |
A table holding payment details for guest journeys, including amounts in both

View file

@ -11,5 +11,9 @@ select
number_bookings as number_bookings,
number_approved_bookings as number_approved_bookings,
number_cancelled_bookings as number_cancelled_bookings,
number_flagged_bookings as number_flagged_bookings
number_flagged_bookings as number_flagged_bookings,
number_incomplete_information_bookings as number_incomplete_information_bookings,
number_no_flags_bookings as number_no_flags_bookings,
number_not_approved_bookings as number_not_approved_bookings,
number_rejected_bookings as number_rejected_bookings
from int_core__new_dash_services_offered

View file

@ -1640,6 +1640,31 @@ models:
description:
"Number of bookings that have a bundle that considers this service and
are flagged."
- name: number_incomplete_information_bookings
data_type: bigint
description:
"Number of bookings that have a bundle that considers this service and
have incomplete information."
- name: number_no_flags_bookings
data_type: bigint
description:
"Number of bookings that have a bundle that considers this service and
have no flags."
- name: number_not_approved_bookings
data_type: bigint
description:
"Number of bookings that have a bundle that considers this service and
are not approved."
- name: number_rejected_bookings
data_type: bigint
description:
"Number of bookings that have a bundle that considers this service and
are rejected."
- name: core__payments
description: |
A table holding payment details for guest journeys, including amounts in both