From 6ecff261f6c387e122741beea49d40f79630b052 Mon Sep 17 00:00:00 2001 From: CIEF ACC1 Date: Thu, 14 Dec 2023 06:00:32 +0000 Subject: [PATCH] Logic fix for is_on_time_delivery --- models/marts/reporting/rep_exchange__daily_orders.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/models/marts/reporting/rep_exchange__daily_orders.sql b/models/marts/reporting/rep_exchange__daily_orders.sql index a626178..abbeb17 100644 --- a/models/marts/reporting/rep_exchange__daily_orders.sql +++ b/models/marts/reporting/rep_exchange__daily_orders.sql @@ -197,6 +197,7 @@ fct_and_dim_joins AS ( CASE -- On-time boolean is null when order is not complete WHEN account_verified_payment_datetime IS NULL THEN NULL + WHEN estimated_order_delivery_datetime_website_sla IS NULL THEN NULL WHEN estimated_order_delivery_datetime_website_sla > orders.operation_uploaded_bank_slip_datetime THEN 1 ELSE 0 END AS is_on_time_delivery_website_sla, @@ -205,6 +206,7 @@ fct_and_dim_joins AS ( CASE -- On-time boolean is null when order is not complete WHEN account_verified_payment_datetime IS NULL THEN NULL + WHEN estimated_order_delivery_datetime_customer_expectation IS NULL THEN NULL WHEN estimated_order_delivery_datetime_customer_expectation > orders.operation_uploaded_bank_slip_datetime THEN 1 ELSE 0 END AS is_on_time_delivery_customer_expectation,