Change WHERE clause to remove tag[= or <>]'open-orders' condition.

Now that we think we know what we're doing, I'm using a more rigorous
approach to defining iterations and tags, and this condition is no
longer necessary, and in fact, may be harmful. This I'm removing it.

The initial load of data will have these values.

iter    | tag         | purpose
--------|-------------|-------------------------------------------------
plan    | baseline    | Adjustments will be made to these values only.
actuals | open-orders | Ordered before 2024 season, still open.
actuals | booked      | Ordered in 2024 season so far
This commit is contained in:
PhilRunninger 2023-08-29 20:02:46 -04:00
parent 5e83df9e5c
commit f0ec96fe2a
5 changed files with 9 additions and 9 deletions

View File

@ -18,7 +18,7 @@ target AS (select target_volume vincr, target_price pincr)
where_clause where_clause
-----------------additional params------------------- -----------------additional params-------------------
AND calc_status||flag <> 'CLOSEDREMAINDER' --exclude short ships when building order adjustments AND calc_status||flag <> 'CLOSEDREMAINDER' --exclude short ships when building order adjustments
AND (order_date <= ship_date OR tag = 'open-orders') AND order_date <= ship_date
) )
-- select * from testv -- select * from testv
-- --
@ -126,7 +126,7 @@ target AS (select target_volume vincr, target_price pincr)
WHEN 'scale new part' THEN module = 'new basket' WHEN 'scale new part' THEN module = 'new basket'
END END
AND calc_status||flag <> 'CLOSEDREMAINDER' --exclude short ships when building order adjustments AND calc_status||flag <> 'CLOSEDREMAINDER' --exclude short ships when building order adjustments
AND (order_date <= ship_date AND tag <> 'open-orders') AND order_date <= ship_date
GROUP BY GROUP BY
promo promo
,terms ,terms
@ -256,7 +256,7 @@ SELECT
WHEN 'scale new part' THEN module = 'new basket' WHEN 'scale new part' THEN module = 'new basket'
END END
AND calc_status||flag <> 'CLOSEDREMAINDER' --exclude short ships when building order adjustments AND calc_status||flag <> 'CLOSEDREMAINDER' --exclude short ships when building order adjustments
AND (order_date <= ship_date AND tag <> 'open-orders') AND order_date <= ship_date
GROUP BY GROUP BY
--fspr in next step --fspr in next step
o.plnt o.plnt

View File

@ -120,7 +120,7 @@ target AS (select $$replace_request$$::json def)
--probably dont want to include adjustments that have blown away volume and good sources of dating info --probably dont want to include adjustments that have blown away volume and good sources of dating info
-----------------additional params------------------- -----------------additional params-------------------
AND calc_status||flag <> 'CLOSEDREMAINDER' --exclude short ships when building order adjustments AND calc_status||flag <> 'CLOSEDREMAINDER' --exclude short ships when building order adjustments
AND (order_date <= ship_date AND tag <> 'open-orders') AND order_date <= ship_date
GROUP BY GROUP BY
promo promo
,terms ,terms

View File

@ -55,7 +55,7 @@ target AS (select target_increment incr)
where_clause where_clause
-----------------additional params------------------- -----------------additional params-------------------
AND calc_status||flag <> 'CLOSEDREMAINDER' --exclude short ships when building order adjustments AND calc_status||flag <> 'CLOSEDREMAINDER' --exclude short ships when building order adjustments
AND (order_date <= ship_date AND tag <> 'open-orders') AND order_date <= ship_date
GROUP BY GROUP BY
fspr fspr
,plnt ---master data ,plnt ---master data

View File

@ -12,7 +12,7 @@ target AS (select incr_qty qincr)
where_clause where_clause
-----------------additional params------------------- -----------------additional params-------------------
AND calc_status||flag <> 'CLOSEDREMAINDER' --exclude short ships when building order adjustments AND calc_status||flag <> 'CLOSEDREMAINDER' --exclude short ships when building order adjustments
AND ( order_date <= ship_date OR tag = 'open-orders') AND order_date <= ship_date
) )
-- select * from testv -- select * from testv
-- --
@ -99,7 +99,7 @@ target AS (select incr_qty qincr)
WHEN 'scale new part' THEN module = 'new basket' WHEN 'scale new part' THEN module = 'new basket'
END END
AND calc_status||flag <> 'CLOSEDREMAINDER' --exclude short ships when building order adjustments AND calc_status||flag <> 'CLOSEDREMAINDER' --exclude short ships when building order adjustments
AND (order_date <= ship_date AND tag <> 'open-orders') AND order_date <= ship_date
GROUP BY GROUP BY
fspr fspr
,plnt ---master data ,plnt ---master data

View File

@ -12,7 +12,7 @@ target AS (select target_vol vincr, target_prc pincr)
where_clause where_clause
-----------------additional params------------------- -----------------additional params-------------------
AND calc_status||flag <> 'CLOSEDREMAINDER' --exclude short ships when building order adjustments AND calc_status||flag <> 'CLOSEDREMAINDER' --exclude short ships when building order adjustments
AND ( order_date <= ship_date OR tag = 'open-orders') AND order_date <= ship_date
) )
-- select * from testv -- select * from testv
-- --
@ -99,7 +99,7 @@ target AS (select target_vol vincr, target_prc pincr)
WHEN 'scale new part' THEN module = 'new basket' WHEN 'scale new part' THEN module = 'new basket'
END END
AND calc_status||flag <> 'CLOSEDREMAINDER' --exclude short ships when building order adjustments AND calc_status||flag <> 'CLOSEDREMAINDER' --exclude short ships when building order adjustments
AND (order_date <= ship_date AND tag <> 'open-orders') AND order_date <= ship_date
GROUP BY GROUP BY
fspr fspr
,plnt ---master data ,plnt ---master data