Fixed the filter for check-in cover verification set and changed named to adopted

This commit is contained in:
Joaquin Ossa 2024-07-03 16:16:58 +02:00
parent fedf808b6b
commit 3ce81dfdd1
2 changed files with 11 additions and 7 deletions

View file

@ -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, date(vs.created_at_utc) as adaptation_date
select vs.id_user_host
from stg_core__verification_set vs
left join
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
-- 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
adoption_date as (
select vs.id_user_host, min(date(vs.created_at_utc)) as adoption_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
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
)
-- this table is to obtain the first verification_set with check_in_cover active
@ -33,9 +37,9 @@ select
u.phone_number,
u.joined_at_utc,
u.joined_date_utc,
ad.adaptation_date,
ad.adoption_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
left join adoption_date ad on ad.id_user_host = u.id_user

View file

@ -970,9 +970,9 @@ models:
data_type: date
description: Date the user joined
- name: adaptation_date
- name: adoption_date
data_type: date
description: Date the user adapted check-in cover
description: Date the user adopted check-in cover
- name: billing_town
data_type: character varying