From e00f454651281f1d2ea5bcd3586de68f49653562 Mon Sep 17 00:00:00 2001 From: Sung Won Chung Date: Wed, 7 Feb 2024 12:26:46 -0800 Subject: [PATCH] Revert "test changes (#5)" This reverts commit c2c29cee30807896e220ac01b830383319c3932f. --- models/core/dim_orgs.sql | 13 ++++++------- models/syncs/sales_sync.sql | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/models/core/dim_orgs.sql b/models/core/dim_orgs.sql index 5d2262d..73beb44 100644 --- a/models/core/dim_orgs.sql +++ b/models/core/dim_orgs.sql @@ -2,10 +2,9 @@ WITH orgs AS ( --prod SELECT org_id - , org_name - , employee_range - , created_at - FROM {{ ref('org_created') }} + , MIN(event_timestamp) AS created_at + FROM {{ ref('signed_in') }} + GROUP BY 1 -- --dev -- SELECT @@ -29,7 +28,7 @@ WITH orgs AS ( org_id , event_timestamp AS sub_created_at , plan as sub_plan - , coalesce(price, 0) as sub_price + , price as sub_price FROM {{ ref('subscription_created') }} ) @@ -39,8 +38,8 @@ SELECT , created_at , num_users , sub_created_at - , case when num_users = 1 then 'Individual' else sub_plan end as sub_plan + , sub_plan , sub_price FROM orgs LEFT JOIN user_count USING (org_id) -LEFT JOIN subscriptions USING (org_id) +LEFT JOIN subscriptions USING (org_id) diff --git a/models/syncs/sales_sync.sql b/models/syncs/sales_sync.sql index 2567aac..ff10d8c 100644 --- a/models/syncs/sales_sync.sql +++ b/models/syncs/sales_sync.sql @@ -3,7 +3,7 @@ WITH org_events AS ( * FROM {{ ref('dim_orgs') }} LEFT JOIN {{ ref('feature_used') }} USING (org_id) - WHERE sub_plan IS NULL or sub_plan = 'Individual' + WHERE sub_plan IS NULL ) , final AS (