Merge branch 'fix-exchange-delivery-on-time-logic' into 'main'

Accommodate new service type and update on-time logic

See merge request cief-data/dbt_cloud!40
This commit is contained in:
CIEF ACC1
2024-04-05 03:15:37 +00:00
2 changed files with 6 additions and 2 deletions
@@ -209,8 +209,9 @@ fct_and_dim_joins AS (
-- On time delivery boolean (CIEF internal SLA)
CASE
-- On-time boolean is null when order is not complete
WHEN service_type IN ('BA') THEN NULL
WHEN service_type IN ('BA', 'RECEIVED-ON-BEHALF') THEN NULL
WHEN transaction_status NOT IN ('UPLOADED_BANK_SLIP') THEN NULL
WHEN order_created_datetime < '2023-01-01' THEN NULL
WHEN estimated_order_delivery_datetime_website_sla > orders.operation_uploaded_bank_slip_datetime THEN 1
WHEN estimated_order_delivery_datetime_website_sla < orders.operation_uploaded_bank_slip_datetime THEN 0
ELSE -999
@@ -219,8 +220,9 @@ fct_and_dim_joins AS (
-- On time delivery boolean (Customer Expectation)
CASE
-- On-time boolean is null when order is not complete
WHEN service_type IN ('BA') THEN NULL
WHEN service_type IN ('BA', 'RECEIVED-ON-BEHALF') THEN NULL
WHEN transaction_status NOT IN ('UPLOADED_BANK_SLIP') THEN NULL
WHEN order_created_datetime < '2023-01-01' THEN NULL
WHEN estimated_order_delivery_datetime_customer_expectation > orders.operation_uploaded_bank_slip_datetime THEN 1
WHEN estimated_order_delivery_datetime_customer_expectation < orders.operation_uploaded_bank_slip_datetime THEN 0
ELSE -999
@@ -536,6 +536,8 @@ purchase_order_invoice_status_redefined AS (
CASE
WHEN order_status IN ('REFUNDED')
THEN 'ORDER_REFUNDED'
WHEN order_status IN ('EXPIRED')
THEN 'ORDER_EXPIRED'
WHEN order_status IN ('COMPLETED', 'APPROVED') AND cost_status IS NULL
THEN 'PENDING_GENERATE_WHITE_FORM'
WHEN order_status IN ('COMPLETED', 'APPROVED') AND cost_status IN ('PENDING_VERIFICATION')