Added date of adaptation
This commit is contained in:
parent
ed5d7828a7
commit
fedf808b6b
2 changed files with 14 additions and 1 deletions
|
|
@ -7,7 +7,7 @@ with
|
|||
select * from {{ ref("stg_core__verification_set_to_verification_type") }}
|
||||
),
|
||||
hosts_with_check_in_cover as (
|
||||
select vs.id_user_host
|
||||
select vs.id_user_host, date(vs.created_at_utc) as adaptation_date
|
||||
from stg_core__verification_set vs
|
||||
left join
|
||||
stg_core__verification_set_to_verification_type vstvt
|
||||
|
|
@ -15,7 +15,14 @@ with
|
|||
where vs.is_active is true and vstvt.id_verification_type = 15
|
||||
-- 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
|
||||
),
|
||||
adaptation_date as (
|
||||
select vs.id_user_host, min(date(vs.created_at_utc)) as adaptation_date
|
||||
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
|
||||
group by vs.id_user_host
|
||||
)
|
||||
-- this table is to obtain the first verification_set with check_in_cover active
|
||||
select
|
||||
u.id_user,
|
||||
u.id_deal,
|
||||
|
|
@ -26,7 +33,9 @@ select
|
|||
u.phone_number,
|
||||
u.joined_at_utc,
|
||||
u.joined_date_utc,
|
||||
ad.adaptation_date,
|
||||
u.billing_town,
|
||||
u.company_name
|
||||
from stg_core__user u
|
||||
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
|
||||
|
|
|
|||
|
|
@ -970,6 +970,10 @@ models:
|
|||
data_type: date
|
||||
description: Date the user joined
|
||||
|
||||
- name: adaptation_date
|
||||
data_type: date
|
||||
description: Date the user adapted check-in cover
|
||||
|
||||
- name: billing_town
|
||||
data_type: character varying
|
||||
description: ""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue