Merged PR 4370: new active_users data
# Description Added active and inactive users: - Active_users: those that are actually using the services in any accommodation of their bundles - Inactive_users: basically the difference between users with the service and active_users # 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. new active_users data Related work items: #25934
This commit is contained in:
commit
b8c953c7eb
4 changed files with 58 additions and 1 deletions
|
|
@ -46,8 +46,23 @@ with
|
|||
),
|
||||
users as (
|
||||
select distinct
|
||||
bs.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,
|
||||
-- Count only users that have at least one active accommodation.
|
||||
-- with this service.
|
||||
count(
|
||||
distinct case
|
||||
when apb.id_accommodation is not null and a.is_active
|
||||
then bs.id_user_host
|
||||
else null
|
||||
end
|
||||
) as number_users_with_service_applied_in_accommodation
|
||||
from bundle_services bs
|
||||
left join
|
||||
int_core__accommodation_to_product_bundle apb
|
||||
on bs.id_user_product_bundle = apb.id_user_product_bundle
|
||||
and bs.id_user_host = apb.id_user_host
|
||||
left join int_core__accommodation a on apb.id_accommodation = a.id_accommodation
|
||||
group by 1
|
||||
),
|
||||
accommodations as (
|
||||
|
|
@ -141,6 +156,10 @@ with
|
|||
select
|
||||
u.service_display_name,
|
||||
u.number_users,
|
||||
u.number_active_users,
|
||||
u.number_users
|
||||
- u.number_users_with_service_applied_in_accommodation
|
||||
as number_users_without_service_applied_in_accommodation,
|
||||
a.number_accommodations,
|
||||
a.number_active_accommodations,
|
||||
a.number_inactive_accommodations,
|
||||
|
|
|
|||
|
|
@ -5263,6 +5263,23 @@ models:
|
|||
that the service is active or used. Each user can associate any of their
|
||||
bundles with any of their accommodations."
|
||||
|
||||
- name: number_users_with_service_applied_in_accommodation
|
||||
data_type: bigint
|
||||
description:
|
||||
"Number of user accounts that have a bundle that considers this service
|
||||
and that bundle is active in at least one active accommodation.
|
||||
In other words there is at least one active accommodation that offers
|
||||
this service for this number of users."
|
||||
|
||||
- name: number_users_without_service_applied_in_accommodation
|
||||
data_type: bigint
|
||||
description:
|
||||
"Number of user accounts that have a bundle that considers this service
|
||||
but none of those bundle with the service is active in any active
|
||||
accommodation.
|
||||
It is basically the difference between number_users and
|
||||
number_users_with_service_applied_in_accommodation."
|
||||
|
||||
- name: number_accommodations
|
||||
data_type: bigint
|
||||
description:
|
||||
|
|
|
|||
|
|
@ -5,6 +5,10 @@ with
|
|||
select
|
||||
service_display_name as service_display_name,
|
||||
number_users as number_users,
|
||||
number_users_with_service_applied_in_accommodation
|
||||
as number_users_with_service_applied_in_accommodation,
|
||||
number_users_without_service_applied_in_accommodation
|
||||
as number_users_without_service_applied_in_accommodation,
|
||||
number_accommodations as number_accommodations,
|
||||
number_active_accommodations as number_active_accommodations,
|
||||
number_inactive_accommodations as number_inactive_accommodations,
|
||||
|
|
|
|||
|
|
@ -1601,6 +1601,23 @@ models:
|
|||
that the service is active or used. Each user can associate any of their
|
||||
bundles with any of their accommodations."
|
||||
|
||||
- name: number_users_with_service_applied_in_accommodation
|
||||
data_type: bigint
|
||||
description:
|
||||
"Number of user accounts that have a bundle that considers this service
|
||||
and that bundle is active in at least one active accommodation.
|
||||
In other words there is at least one active accommodation that offers
|
||||
this service for this number of users."
|
||||
|
||||
- name: number_users_without_service_applied_in_accommodation
|
||||
data_type: bigint
|
||||
description:
|
||||
"Number of user accounts that have a bundle that considers this service
|
||||
but none of those bundle with the service is active in any active
|
||||
accommodation.
|
||||
It is basically the difference between number_users and
|
||||
number_users_with_service_applied_in_accommodation."
|
||||
|
||||
- name: number_accommodations
|
||||
data_type: bigint
|
||||
description:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue