Accommodate new service type and update on-time logic

This commit is contained in:
Yam ZhengLim
2024-04-05 03:14:14 +00:00
parent 4ffb64a78b
commit 6cbc293e25
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) -- On time delivery boolean (CIEF internal SLA)
CASE CASE
-- On-time boolean is null when order is not complete -- 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 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 1
WHEN estimated_order_delivery_datetime_website_sla < orders.operation_uploaded_bank_slip_datetime THEN 0 WHEN estimated_order_delivery_datetime_website_sla < orders.operation_uploaded_bank_slip_datetime THEN 0
ELSE -999 ELSE -999
@@ -219,8 +220,9 @@ fct_and_dim_joins AS (
-- On time delivery boolean (Customer Expectation) -- On time delivery boolean (Customer Expectation)
CASE CASE
-- On-time boolean is null when order is not complete -- 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 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 1
WHEN estimated_order_delivery_datetime_customer_expectation < orders.operation_uploaded_bank_slip_datetime THEN 0 WHEN estimated_order_delivery_datetime_customer_expectation < orders.operation_uploaded_bank_slip_datetime THEN 0
ELSE -999 ELSE -999
@@ -536,6 +536,8 @@ purchase_order_invoice_status_redefined AS (
CASE CASE
WHEN order_status IN ('REFUNDED') WHEN order_status IN ('REFUNDED')
THEN 'ORDER_REFUNDED' THEN 'ORDER_REFUNDED'
WHEN order_status IN ('EXPIRED')
THEN 'ORDER_EXPIRED'
WHEN order_status IN ('COMPLETED', 'APPROVED') AND cost_status IS NULL WHEN order_status IN ('COMPLETED', 'APPROVED') AND cost_status IS NULL
THEN 'PENDING_GENERATE_WHITE_FORM' THEN 'PENDING_GENERATE_WHITE_FORM'
WHEN order_status IN ('COMPLETED', 'APPROVED') AND cost_status IN ('PENDING_VERIFICATION') WHEN order_status IN ('COMPLETED', 'APPROVED') AND cost_status IN ('PENDING_VERIFICATION')