Addressed comments

This commit is contained in:
Joaquin Ossa 2025-02-10 08:09:22 +01:00
parent 25aa153eed
commit 560531aa1e
5 changed files with 36 additions and 26 deletions

View file

@ -71,13 +71,7 @@ vars:
# Booking state variables
# States should be strings in capital letters. Models need to force an upper()
"cancelled_booking_state": "'CANCELLED'"
# Booking state variables
# States should be strings in capital letters. Models need to force an upper()
"approved_booking_state": "'APPROVED'"
# Booking state variables
# States should be strings in capital letters. Models need to force an upper()
"flagged_booking_state": "'FLAGGED'"
# Payment state variables

View file

@ -16,7 +16,10 @@ with
),
int_core__bookings as (select * from {{ ref("int_core__bookings") }}),
bundle_services as (
select id_user_product_bundle, id_user_host, product_service_display_name
select
id_user_product_bundle,
id_user_host,
product_service_name as service_display_name
from int_core__user_product_bundle_contains_services
-- Union of all product services with all protection plan services.
-- This is because there are basically two types of services: product services
@ -27,20 +30,24 @@ with
id_user_host,
coalesce(
protection_display_name, {{ var("default_service") }}
) as product_service_display_name
) as service_display_name
from int_core__user_product_bundle
),
users as (
select distinct
(bs.product_service_display_name),
count(distinct bs.id_user_host) as number_users
bs.service_display_name, count(distinct bs.id_user_host) as number_users
from bundle_services bs
inner join int_core__user_host uh on bs.id_user_host = uh.id_user_host
inner join
int_core__user_host uh
on bs.id_user_host = uh.id_user_host
and uh.is_user_in_new_dash = true
and uh.is_missing_id_deal = false
and uh.is_test_account = false
group by 1
),
accommodations as (
select distinct
(bs.product_service_display_name),
bs.service_display_name,
count(distinct apb.id_accommodation) as number_accommodations,
count(
distinct case when a.is_active then apb.id_accommodation else null end
@ -58,12 +65,17 @@ with
apb.original_ends_at_utc, {{ var("end_of_time") }}
)
left join int_core__accommodation a on apb.id_accommodation = a.id_accommodation
inner join int_core__new_dash_users ndu on bs.id_user_host = ndu.id_user_host
inner join
int_core__user_host uh
on bs.id_user_host = uh.id_user_host
and uh.is_user_in_new_dash = true
and uh.is_missing_id_deal = false
and uh.is_test_account = false
group by 1
),
bookings as (
select distinct
(bs.product_service_display_name),
bs.service_display_name,
count(distinct bpb.id_booking) as number_bookings,
count(
distinct case
@ -94,11 +106,16 @@ with
int_core__bookings b
on b.id_booking = bpb.id_booking
and b.is_duplicate_booking is false
inner join int_core__new_dash_users ndu on bs.id_user_host = ndu.id_user_host
inner join
int_core__user_host uh
on bs.id_user_host = uh.id_user_host
and uh.is_user_in_new_dash = true
and uh.is_missing_id_deal = false
and uh.is_test_account = false
group by 1
)
select
u.product_service_display_name,
u.service_display_name,
u.number_users,
a.number_accommodations,
a.number_active_accommodations,
@ -108,6 +125,5 @@ select
b.number_cancelled_bookings,
b.number_flagged_bookings
from users u
left join
accommodations a on u.product_service_display_name = a.product_service_display_name
left join bookings b on u.product_service_display_name = b.product_service_display_name
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

@ -5175,13 +5175,13 @@ models:
- name: int_core__new_dash_services_offered
description: "This model contains the the services offered in New Dash.
This offers are displayed by different levels, such as the number of users,
These offers are displayed by different levels, such as the number of users,
accommodations and bookings."
columns:
- name: product_service_display_name
- name: service_display_name
data_type: text
description: "The name of the product service."
description: "The name of the New Dash service."
data_tests:
- not_null
- accepted_values:

View file

@ -3,7 +3,7 @@ with
select * from {{ ref("int_core__new_dash_services_offered") }}
)
select
product_service_display_name as product_service_display_name,
service_display_name as service_display_name,
number_users as number_users,
number_accommodations as number_accommodations,
number_active_accommodations as number_active_accommodations,

View file

@ -1570,13 +1570,13 @@ models:
- name: core__new_dash_services_offered
description: "This model contains the the services offered in New Dash.
This offers are displayed by different levels, such as the number of users,
These offers are displayed by different levels, such as the number of users,
accommodations and bookings."
columns:
- name: product_service_display_name
- name: service_display_name
data_type: text
description: "The name of the product service."
description: "The name of the New Dash service."
data_tests:
- not_null
- accepted_values: