changed names
This commit is contained in:
parent
e85de15d22
commit
a543fa1d83
4 changed files with 18 additions and 18 deletions
|
|
@ -12,10 +12,10 @@ select
|
|||
atpb.id_user_product_bundle,
|
||||
upb.id_user_host,
|
||||
upb.product_bundle_display_name as user_product_bundle_name,
|
||||
atpb.starts_at_utc,
|
||||
atpb.ends_at_utc,
|
||||
date(atpb.starts_at_utc) as starts_date_utc,
|
||||
date(atpb.ends_at_utc) as ends_date_utc,
|
||||
atpb.starts_at_utc as start_at_utc,
|
||||
atpb.ends_at_utc as end_at_utc,
|
||||
date(atpb.starts_at_utc) as start_date_utc,
|
||||
date(atpb.ends_at_utc) as end_date_utc,
|
||||
atpb.has_no_end_date,
|
||||
upb.product_bundle_services,
|
||||
upb.is_custom_bundle,
|
||||
|
|
|
|||
|
|
@ -68,9 +68,9 @@ with
|
|||
count(
|
||||
distinct case
|
||||
when
|
||||
atpb.starts_date_utc <= current_date
|
||||
atpb.start_date_utc <= current_date
|
||||
and (
|
||||
atpb.ends_date_utc >= current_date
|
||||
atpb.end_date_utc >= current_date
|
||||
or atpb.has_no_end_date = true
|
||||
)
|
||||
then atpb.id_accommodation
|
||||
|
|
@ -80,9 +80,9 @@ with
|
|||
count(
|
||||
distinct case
|
||||
when
|
||||
atpb.starts_date_utc <= current_date
|
||||
atpb.start_date_utc <= current_date
|
||||
and (
|
||||
atpb.ends_date_utc >= current_date
|
||||
atpb.end_date_utc >= current_date
|
||||
or atpb.has_no_end_date = true
|
||||
)
|
||||
and atpb.user_product_bundle_name
|
||||
|
|
|
|||
|
|
@ -2183,7 +2183,7 @@ models:
|
|||
description: |
|
||||
The name of the Product Bundle.
|
||||
|
||||
- name: starts_at_utc
|
||||
- name: start_at_utc
|
||||
data_type: timestamp
|
||||
description: |
|
||||
Timestamp of when this Product Bundle is assigned into an Accommodation was
|
||||
|
|
@ -2191,21 +2191,21 @@ models:
|
|||
data_tests:
|
||||
- not_null
|
||||
|
||||
- name: ends_at_utc
|
||||
- name: end_at_utc
|
||||
data_type: timestamp
|
||||
description: |
|
||||
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
|
||||
it's currently active.
|
||||
|
||||
- name: starts_date_utc
|
||||
- name: start_date_utc
|
||||
data_type: date
|
||||
description: |
|
||||
The date when this Product Bundle was first assigned to the Accommodation.
|
||||
data_tests:
|
||||
- not_null
|
||||
|
||||
- name: ends_date_utc
|
||||
- name: end_date_utc
|
||||
data_type: date
|
||||
description: |
|
||||
The date when this Product Bundle was last active for the Accommodation.
|
||||
|
|
|
|||
|
|
@ -16,11 +16,11 @@ with
|
|||
select
|
||||
*,
|
||||
row_number() over (
|
||||
partition by id_accommodation, starts_date_utc
|
||||
partition by id_accommodation, start_date_utc
|
||||
order by
|
||||
starts_date_utc desc, -- Prefers the latest effective start date
|
||||
starts_at_utc desc, -- In case of ties, prefers the most recent original start
|
||||
coalesce(ends_at_utc, {{ var("end_of_time") }}) desc
|
||||
start_date_utc desc, -- Prefers the latest effective start date
|
||||
start_at_utc desc, -- In case of ties, prefers the most recent original start
|
||||
coalesce(end_at_utc, {{ var("end_of_time") }}) desc
|
||||
) as rn
|
||||
from {{ ref("int_core__accommodation_to_product_bundle") }}
|
||||
)
|
||||
|
|
@ -51,8 +51,8 @@ inner join
|
|||
inner join
|
||||
latest_daily_bundle as ldb
|
||||
on bs.id_user_product_bundle = ldb.id_user_product_bundle
|
||||
and date >= ldb.starts_date_utc
|
||||
and (date < ldb.ends_date_utc or ldb.has_no_end_date = true)
|
||||
and date >= ldb.start_date_utc
|
||||
and (date < ldb.end_date_utc or ldb.has_no_end_date = true)
|
||||
and ldb.rn = 1
|
||||
left join
|
||||
{{ ref("int_kpis__dimension_daily_accommodation") }} as icmas
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue