Compare commits
No commits in common. "5adda4172799928c7717ed629ed16aaef1269634" and "0415dad1f254bed7a1e3d9cf80e44f66bb949b97" have entirely different histories.
5adda41727
...
0415dad1f2
@ -33,7 +33,7 @@ route baseline
|
|||||||
- [x] setup something to fill in sql parameters to do testing on the function
|
- [x] setup something to fill in sql parameters to do testing on the function
|
||||||
- [ ] update node to handle forecast name parameter
|
- [ ] update node to handle forecast name parameter
|
||||||
- [ ] calc status is hard-coded right now in the json request -> probably needs to be manuall supplied up front
|
- [ ] calc status is hard-coded right now in the json request -> probably needs to be manuall supplied up front
|
||||||
- [ ] **the sales data has to have a column for module**
|
- [ ] the sales data has to have a column for module
|
||||||
|
|
||||||
scale
|
scale
|
||||||
----------------------------------------------------------------------------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -13,32 +13,13 @@ DECLARE
|
|||||||
_date_funcs jsonb;
|
_date_funcs jsonb;
|
||||||
_perd_joins text;
|
_perd_joins text;
|
||||||
_interval interval;
|
_interval interval;
|
||||||
_units_col text;
|
|
||||||
_value_col text;
|
|
||||||
|
|
||||||
|
|
||||||
BEGIN
|
BEGIN
|
||||||
-----------------populate application variables--------------------------------------------
|
|
||||||
SELECT (SELECT cname FROM fc.target_meta WHERE appcol = 'order_date') INTO _order_date;
|
|
||||||
SELECT (SELECT cname FROM fc.target_meta WHERE appcol = 'ship_date') INTO _ship_date;
|
|
||||||
SELECT (SELECT cname FROM fc.target_meta WHERE appcol = 'order_status') INTO _order_status;
|
|
||||||
SELECT (SELECT cname FROM fc.target_meta WHERE appcol = 'units') INTO _units_col;
|
|
||||||
SELECT (SELECT cname FROM fc.target_meta WHERE appcol = 'value') INTO _value_col;
|
|
||||||
-------------------------all columns except value and units--------------------------------
|
|
||||||
SELECT
|
|
||||||
string_agg('o.'||format('%I',cname),E'\n ,' ORDER BY opos ASC)
|
|
||||||
INTO
|
|
||||||
_clist
|
|
||||||
FROM
|
|
||||||
fc.target_meta
|
|
||||||
WHERE
|
|
||||||
func NOT IN ('version');
|
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
---------$$app_req$$ will hold the request body--------------------
|
|
||||||
$$WITH
|
$$WITH
|
||||||
req AS (SELECT $$||'$$app_req$$::jsonb)'||$$
|
req AS (SELECT $$||'$$app_req$$::jsonb)'||$$
|
||||||
-----this block is supposed to test for new products that might not be in baseline etc-------
|
|
||||||
test AS (
|
test AS (
|
||||||
SELECT
|
SELECT
|
||||||
sum(app_units) FILTER WHERE (version <> 'ACTUALS') total
|
sum(app_units) FILTER WHERE (version <> 'ACTUALS') total
|
||||||
@ -48,23 +29,10 @@ test AS (
|
|||||||
WHERE
|
WHERE
|
||||||
app_where
|
app_where
|
||||||
)
|
)
|
||||||
,basemix AS (
|
|
||||||
SELECT
|
|
||||||
$$||_clist||$$
|
|
||||||
WHERE
|
|
||||||
app_scenario
|
|
||||||
),
|
|
||||||
vscale AS (
|
|
||||||
SELECT
|
|
||||||
app_vincr AS target_increment
|
|
||||||
,sum($$||_units_col||') AS '||units||$$
|
|
||||||
,app_vincr/sum($$||_units_col||$$) factor
|
|
||||||
)$$
|
|
||||||
INTO
|
|
||||||
_sql;
|
|
||||||
|
|
||||||
RAISE NOTICE '%', _sql;
|
|
||||||
|
SELECT 'HI' into _sql;
|
||||||
|
|
||||||
INSERT INTO fc.sql SELECT 'scale', _sql ON CONFLICT ON CONSTRAINT sql_pkey DO UPDATE SET t = EXCLUDED.t;
|
INSERT INTO fc.sql SELECT 'scale', _sql ON CONFLICT ON CONSTRAINT sql_pkey DO UPDATE SET t = EXCLUDED.t;
|
||||||
|
|
||||||
END
|
END
|
||||||
|
Loading…
Reference in New Issue
Block a user