Merged PR 2188: Added date of adaptation

Added date of adaptation when hosts first started using check-in cover
This commit is contained in:
Joaquin Ossa 2024-07-04 10:08:13 +00:00
commit 2c366414ce
4 changed files with 26 additions and 0 deletions

View file

@ -15,7 +15,20 @@ 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
),
check_in_cover_added_date_utc as (
select
vs.id_user_host,
min(date(vs.created_at_utc)) as check_in_cover_added_date_utc
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
select
u.id_user,
u.id_deal,
@ -26,7 +39,9 @@ select
u.phone_number,
u.joined_at_utc,
u.joined_date_utc,
ad.check_in_cover_added_date_utc,
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 check_in_cover_added_date_utc ad on ad.id_user_host = u.id_user

View file

@ -984,6 +984,11 @@ models:
data_type: date
description: Date the user joined
- name: check_in_cover_added_date_utc
data_type: date
description:
Date the user first included check-in cover
- name: billing_town
data_type: character varying
description: ""

View file

@ -13,6 +13,7 @@ select
phone_number as phone_number,
joined_at_utc as joined_at_utc,
joined_date_utc as joined_date_utc,
check_in_cover_added_date_utc as check_in_cover_added_date_utc,
billing_town as billing_town,
company_name as company_name
from int_core__check_in_cover_users

View file

@ -924,6 +924,11 @@ models:
data_type: date
description: Date the user joined
- name: check_in_cover_added_date_utc
data_type: date
description:
Date the user first included check-in cover
- name: billing_town
data_type: character varying
description: ""