Update to listing count in new dash overview

This commit is contained in:
Joaquin 2025-04-03 16:00:43 +02:00
parent 4bef83f432
commit 82829db3d2
6 changed files with 55 additions and 46 deletions

View file

@ -47,26 +47,35 @@ with
count(
distinct case
when
atpb.user_product_bundle_name
not in ({{ var("default_service") }})
atpb.effective_start_date_utc <= current_date
and coalesce(
atpb.effective_end_date_utc, {{ var("end_of_time") }}
)
>= current_date
then atpb.id_accommodation
else null
end
) as total_listings_with_product_bundle_with_paid_service,
) as total_active_listings_with_active_product_bundle,
count(
distinct case
when
atpb.user_product_bundle_name
atpb.effective_start_date_utc <= current_date
and coalesce(
atpb.effective_end_date_utc, {{ var("end_of_time") }}
)
>= current_date
and atpb.user_product_bundle_name
not in ({{ var("default_service") }})
and atpb.has_no_end_date = true
then atpb.id_accommodation
else null
end
) as total_listings_with_active_product_bundle_with_paid_service
) as total_active_listings_with_active_product_bundle_with_paid_service
from int_core__user_product_bundle upb
left join
int_core__accommodation_to_product_bundle atpb
on upb.id_user_product_bundle = atpb.id_user_product_bundle
inner join int_core__accommodation a on upb.id_user_host = a.id_user_host
where a.is_active = true
group by 1
),
btpb_aggregation as (
@ -107,8 +116,8 @@ with
upb.total_active_user_product_bundles,
a.total_listings,
a.total_active_listings,
atpb.total_listings_with_product_bundle_with_paid_service,
atpb.total_listings_with_active_product_bundle_with_paid_service,
atpb.total_active_listings_with_active_product_bundle,
atpb.total_active_listings_with_active_product_bundle_with_paid_service,
btpb.total_bookings_with_product_bundle,
btpb.total_bookings_with_product_bundle_with_paid_service
from upb_aggregation upb
@ -139,17 +148,17 @@ select
total_active_user_product_bundles,
total_listings,
total_active_listings,
total_listings_with_product_bundle_with_paid_service,
total_listings_with_active_product_bundle_with_paid_service,
total_active_listings_with_active_product_bundle,
total_active_listings_with_active_product_bundle_with_paid_service,
case when total_active_listings > 0 then 1 else 0 end as has_active_listings,
case
when total_listings_with_product_bundle_with_paid_service > 0 then 1 else 0
end as has_listings_with_paid_service_applied,
when total_active_listings_with_active_product_bundle > 0 then 1 else 0
end as has_active_listings_with_active_product_bundle_applied,
case
when total_listings_with_active_product_bundle_with_paid_service > 0
when total_active_listings_with_active_product_bundle_with_paid_service > 0
then 1
else 0
end as has_listings_with_active_paid_service_applied,
end as has_active_listings_with_active_paid_service_applied,
total_bookings_with_product_bundle,
total_bookings_with_product_bundle_with_paid_service,
case

View file

@ -2639,16 +2639,15 @@ models:
activation - not to be confused with activity-based
segmentation).
- name: total_listings_with_product_bundle_with_paid_service
- name: total_active_listings_with_active_product_bundle
data_type: integer
description: |
Count of listings that have, or have had, a paid service
product bundle activated.
Count of active listings that currently have an active product bundle.
- name: total_listings_with_active_product_bundle_with_paid_service
- name: total_active_listings_with_active_product_bundle_with_paid_service
data_type: integer
description: |
Count of listings that currently have an active paid service
Count of active listings that currently have an active paid service
product bundle.
- name: has_active_listings
@ -2656,15 +2655,17 @@ models:
description: |
Integer-based flag version of total_active_listings.
- name: has_listings_with_paid_service_applied
- name: has_active_listings_with_active_product_bundle_applied
data_type: integer
description: |
Integer-based flag version of total_listings_with_product_bundle_with_paid_service.
Integer-based flag version of
total_active_listings_with_active_product_bundle.
- name: has_listings_with_active_paid_service_applied
- name: has_active_listings_with_active_paid_service_applied
data_type: integer
description: |
Integer-based flag version of total_listings_with_active_product_bundle_with_paid_service.
Integer-based flag version of
total_active_listings_with_active_product_bundle_with_paid_service.
- name: total_bookings_with_product_bundle
data_type: integer