swap out iterdef with module, and point to osm_pool

This commit is contained in:
Paul Trowbridge 2020-02-13 12:18:32 -05:00
parent 21cb531e56
commit 04276a89cb

View File

@ -4,9 +4,9 @@ target AS (select target_vol vincr, target_prc pincr)
SELECT
sum(fb_qty) tot
,sum(fb_qty) FILTER (WHERE iter = 'copy') base
,sum(fb_qty) FILTER (WHERE iterdef->>'type' = 'new basket') newpart
,sum(fb_qty) FILTER (WHERE module = 'new basket') newpart
FROM
rlarp.osm_fcpool
rlarp.osm_pool
WHERE
-----------------scenario----------------------------
where_clause
@ -145,7 +145,7 @@ target AS (select target_vol vincr, target_prc pincr)
,null cost_usd
,null units
FROM
rlarp.osm_fcpool
rlarp.osm_pool
WHERE
-----------------scenario----------------------------
where_clause
@ -153,7 +153,7 @@ target AS (select target_vol vincr, target_prc pincr)
AND CASE (SELECT flag FROM flagv)
WHEN 'scale all' THEN true
WHEN 'scale copy' THEN iter = 'copy'
WHEN 'scale new part' THEN iterdef->>'type' = 'new basket'
WHEN 'scale new part' THEN module = 'new basket'
END
AND calc_status||flag <> 'CLOSEDREMAINDER' --exclude short ships when building order adjustments
AND adj_orderdate <= adj_shipdate
@ -496,7 +496,7 @@ target AS (select target_vol vincr, target_prc pincr)
)
--select sum(value_usd), sum(fb_qty) from pricing
, ins AS (
INSERT INTO rlarp.osm_fcpool (SELECT * FROM pricing UNION ALL SELECT * FROM volume) RETURNING *
INSERT INTO rlarp.osm_pool (SELECT * FROM pricing UNION ALL SELECT * FROM volume) RETURNING *
)
,insagg AS (
SELECT