From 3ce81dfdd110fb5833f191e24cc26ace82fc61e1 Mon Sep 17 00:00:00 2001 From: Joaquin Ossa Date: Wed, 3 Jul 2024 16:16:58 +0200 Subject: [PATCH] Fixed the filter for check-in cover verification set and changed named to adopted --- .../core/int_core__check_in_cover_users.sql | 14 +++++++++----- models/intermediate/core/schema.yaml | 4 ++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/models/intermediate/core/int_core__check_in_cover_users.sql b/models/intermediate/core/int_core__check_in_cover_users.sql index 97b327f..abcc443 100644 --- a/models/intermediate/core/int_core__check_in_cover_users.sql +++ b/models/intermediate/core/int_core__check_in_cover_users.sql @@ -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 diff --git a/models/intermediate/core/schema.yaml b/models/intermediate/core/schema.yaml index c44b572..f6ec6b1 100644 --- a/models/intermediate/core/schema.yaml +++ b/models/intermediate/core/schema.yaml @@ -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