new active_users data
This commit is contained in:
parent
9fa9f0c714
commit
9af7b27e04
4 changed files with 50 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_active_users
|
||||
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,8 @@ with
|
|||
select
|
||||
u.service_display_name,
|
||||
u.number_users,
|
||||
u.number_active_users,
|
||||
u.number_users - u.number_active_users as number_inactive_users,
|
||||
a.number_accommodations,
|
||||
a.number_active_accommodations,
|
||||
a.number_inactive_accommodations,
|
||||
|
|
|
|||
|
|
@ -5263,6 +5263,21 @@ models:
|
|||
that the service is active or used. Each user can associate any of their
|
||||
bundles with any of their accommodations."
|
||||
|
||||
- name: number_active_users
|
||||
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_inactive_users
|
||||
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_active_users."
|
||||
|
||||
- name: number_accommodations
|
||||
data_type: bigint
|
||||
description:
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ with
|
|||
select
|
||||
service_display_name as service_display_name,
|
||||
number_users as number_users,
|
||||
number_active_users as number_active_users,
|
||||
number_inactive_users as number_inactive_users,
|
||||
number_accommodations as number_accommodations,
|
||||
number_active_accommodations as number_active_accommodations,
|
||||
number_inactive_accommodations as number_inactive_accommodations,
|
||||
|
|
|
|||
|
|
@ -1601,6 +1601,21 @@ models:
|
|||
that the service is active or used. Each user can associate any of their
|
||||
bundles with any of their accommodations."
|
||||
|
||||
- name: number_active_users
|
||||
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_inactive_users
|
||||
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_active_users."
|
||||
|
||||
- name: number_accommodations
|
||||
data_type: bigint
|
||||
description:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue