changed names

This commit is contained in:
Joaquin 2025-06-10 14:20:28 +02:00
parent e85de15d22
commit a543fa1d83
4 changed files with 18 additions and 18 deletions

View file

@ -12,10 +12,10 @@ select
atpb.id_user_product_bundle, atpb.id_user_product_bundle,
upb.id_user_host, upb.id_user_host,
upb.product_bundle_display_name as user_product_bundle_name, upb.product_bundle_display_name as user_product_bundle_name,
atpb.starts_at_utc, atpb.starts_at_utc as start_at_utc,
atpb.ends_at_utc, atpb.ends_at_utc as end_at_utc,
date(atpb.starts_at_utc) as starts_date_utc, date(atpb.starts_at_utc) as start_date_utc,
date(atpb.ends_at_utc) as ends_date_utc, date(atpb.ends_at_utc) as end_date_utc,
atpb.has_no_end_date, atpb.has_no_end_date,
upb.product_bundle_services, upb.product_bundle_services,
upb.is_custom_bundle, upb.is_custom_bundle,

View file

@ -68,9 +68,9 @@ with
count( count(
distinct case distinct case
when when
atpb.starts_date_utc <= current_date atpb.start_date_utc <= current_date
and ( and (
atpb.ends_date_utc >= current_date atpb.end_date_utc >= current_date
or atpb.has_no_end_date = true or atpb.has_no_end_date = true
) )
then atpb.id_accommodation then atpb.id_accommodation
@ -80,9 +80,9 @@ with
count( count(
distinct case distinct case
when when
atpb.starts_date_utc <= current_date atpb.start_date_utc <= current_date
and ( and (
atpb.ends_date_utc >= current_date atpb.end_date_utc >= current_date
or atpb.has_no_end_date = true or atpb.has_no_end_date = true
) )
and atpb.user_product_bundle_name and atpb.user_product_bundle_name

View file

@ -2183,7 +2183,7 @@ models:
description: | description: |
The name of the Product Bundle. The name of the Product Bundle.
- name: starts_at_utc - name: start_at_utc
data_type: timestamp data_type: timestamp
description: | description: |
Timestamp of when this Product Bundle is assigned into an Accommodation was Timestamp of when this Product Bundle is assigned into an Accommodation was
@ -2191,21 +2191,21 @@ models:
data_tests: data_tests:
- not_null - not_null
- name: ends_at_utc - name: end_at_utc
data_type: timestamp data_type: timestamp
description: | description: |
Timestamp of when this Product Bundle is assigned into an Accommodation was Timestamp of when this Product Bundle is assigned into an Accommodation was
active for the last time, according to the Backend. If null it means that active for the last time, according to the Backend. If null it means that
it's currently active. it's currently active.
- name: starts_date_utc - name: start_date_utc
data_type: date data_type: date
description: | description: |
The date when this Product Bundle was first assigned to the Accommodation. The date when this Product Bundle was first assigned to the Accommodation.
data_tests: data_tests:
- not_null - not_null
- name: ends_date_utc - name: end_date_utc
data_type: date data_type: date
description: | description: |
The date when this Product Bundle was last active for the Accommodation. The date when this Product Bundle was last active for the Accommodation.

View file

@ -16,11 +16,11 @@ with
select select
*, *,
row_number() over ( row_number() over (
partition by id_accommodation, starts_date_utc partition by id_accommodation, start_date_utc
order by order by
starts_date_utc desc, -- Prefers the latest effective start date start_date_utc desc, -- Prefers the latest effective start date
starts_at_utc desc, -- In case of ties, prefers the most recent original start start_at_utc desc, -- In case of ties, prefers the most recent original start
coalesce(ends_at_utc, {{ var("end_of_time") }}) desc coalesce(end_at_utc, {{ var("end_of_time") }}) desc
) as rn ) as rn
from {{ ref("int_core__accommodation_to_product_bundle") }} from {{ ref("int_core__accommodation_to_product_bundle") }}
) )
@ -51,8 +51,8 @@ inner join
inner join inner join
latest_daily_bundle as ldb latest_daily_bundle as ldb
on bs.id_user_product_bundle = ldb.id_user_product_bundle on bs.id_user_product_bundle = ldb.id_user_product_bundle
and date >= ldb.starts_date_utc and date >= ldb.start_date_utc
and (date < ldb.ends_date_utc or ldb.has_no_end_date = true) and (date < ldb.end_date_utc or ldb.has_no_end_date = true)
and ldb.rn = 1 and ldb.rn = 1
left join left join
{{ ref("int_kpis__dimension_daily_accommodation") }} as icmas {{ ref("int_kpis__dimension_daily_accommodation") }} as icmas