Fixed the filter for check-in cover verification set and changed named to adopted
This commit is contained in:
parent
fedf808b6b
commit
3ce81dfdd1
2 changed files with 11 additions and 7 deletions
|
|
@ -7,7 +7,7 @@ with
|
||||||
select * from {{ ref("stg_core__verification_set_to_verification_type") }}
|
select * from {{ ref("stg_core__verification_set_to_verification_type") }}
|
||||||
),
|
),
|
||||||
hosts_with_check_in_cover as (
|
hosts_with_check_in_cover as (
|
||||||
select vs.id_user_host, date(vs.created_at_utc) as adaptation_date
|
select vs.id_user_host
|
||||||
from stg_core__verification_set vs
|
from stg_core__verification_set vs
|
||||||
left join
|
left join
|
||||||
stg_core__verification_set_to_verification_type vstvt
|
stg_core__verification_set_to_verification_type vstvt
|
||||||
|
|
@ -16,10 +16,14 @@ with
|
||||||
-- vs.isactive is to consider the current verification set used by the host
|
-- vs.isactive is to consider the current verification set used by the host
|
||||||
-- vstvt.id_verification_type = 15 is the value for check_in_cover verification
|
-- vstvt.id_verification_type = 15 is the value for check_in_cover verification
|
||||||
),
|
),
|
||||||
adaptation_date as (
|
adoption_date as (
|
||||||
select vs.id_user_host, min(date(vs.created_at_utc)) as adaptation_date
|
select vs.id_user_host, min(date(vs.created_at_utc)) as adoption_date
|
||||||
from stg_core__verification_set as vs
|
from stg_core__verification_set as vs
|
||||||
left join hosts_with_check_in_cover as hcv on vs.id_user_host = hcv.id_user_host
|
left join hosts_with_check_in_cover as hcv on vs.id_user_host = hcv.id_user_host
|
||||||
|
left join
|
||||||
|
stg_core__verification_set_to_verification_type vstvt
|
||||||
|
on vs.id_verification_set = vstvt.id_verification_set
|
||||||
|
where vstvt.id_verification_type = 15
|
||||||
group by vs.id_user_host
|
group by vs.id_user_host
|
||||||
)
|
)
|
||||||
-- this table is to obtain the first verification_set with check_in_cover active
|
-- this table is to obtain the first verification_set with check_in_cover active
|
||||||
|
|
@ -33,9 +37,9 @@ select
|
||||||
u.phone_number,
|
u.phone_number,
|
||||||
u.joined_at_utc,
|
u.joined_at_utc,
|
||||||
u.joined_date_utc,
|
u.joined_date_utc,
|
||||||
ad.adaptation_date,
|
ad.adoption_date,
|
||||||
u.billing_town,
|
u.billing_town,
|
||||||
u.company_name
|
u.company_name
|
||||||
from stg_core__user u
|
from stg_core__user u
|
||||||
inner join hosts_with_check_in_cover hcih on hcih.id_user_host = u.id_user
|
inner join hosts_with_check_in_cover hcih on hcih.id_user_host = u.id_user
|
||||||
left join adaptation_date ad on ad.id_user_host = u.id_user
|
left join adoption_date ad on ad.id_user_host = u.id_user
|
||||||
|
|
|
||||||
|
|
@ -970,9 +970,9 @@ models:
|
||||||
data_type: date
|
data_type: date
|
||||||
description: Date the user joined
|
description: Date the user joined
|
||||||
|
|
||||||
- name: adaptation_date
|
- name: adoption_date
|
||||||
data_type: date
|
data_type: date
|
||||||
description: Date the user adapted check-in cover
|
description: Date the user adopted check-in cover
|
||||||
|
|
||||||
- name: billing_town
|
- name: billing_town
|
||||||
data_type: character varying
|
data_type: character varying
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue