diff --git a/dbt_project.yml b/dbt_project.yml index 94fd499..529ec70 100644 --- a/dbt_project.yml +++ b/dbt_project.yml @@ -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 diff --git a/models/intermediate/core/int_core__new_dash_services_offered.sql b/models/intermediate/core/int_core__new_dash_services_offered.sql index 33bcbc1..784a4bd 100644 --- a/models/intermediate/core/int_core__new_dash_services_offered.sql +++ b/models/intermediate/core/int_core__new_dash_services_offered.sql @@ -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 diff --git a/models/intermediate/core/schema.yml b/models/intermediate/core/schema.yml index 7267fe4..ed75db2 100644 --- a/models/intermediate/core/schema.yml +++ b/models/intermediate/core/schema.yml @@ -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: diff --git a/models/reporting/core/core__new_dash_services_offered.sql b/models/reporting/core/core__new_dash_services_offered.sql index dabcafc..78e870f 100644 --- a/models/reporting/core/core__new_dash_services_offered.sql +++ b/models/reporting/core/core__new_dash_services_offered.sql @@ -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, diff --git a/models/reporting/core/schema.yml b/models/reporting/core/schema.yml index a28ea10..7be6992 100644 --- a/models/reporting/core/schema.yml +++ b/models/reporting/core/schema.yml @@ -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: