dont use iterdet anymore since not in osm. iter = source + behavior

This commit is contained in:
Paul Trowbridge 2019-03-14 10:47:29 -04:00
parent 1f97d74257
commit 932c95e83c
7 changed files with 13 additions and 18 deletions

View File

@ -31,7 +31,7 @@ Postgres.FirstRow = function (inSQL, args, inResponse) {
}); });
}; };
server.get('/', (req, res) => res.send('node.js express is up and running 🤩')) server.get('/', (req, res) => res.send('node.js express is up and running'))
server.get('/logs', (req, res) => res.sendFile('~/forecast_api/logs.html')) server.get('/logs', (req, res) => res.sendFile('~/forecast_api/logs.html'))
@ -149,8 +149,7 @@ server.post('/addmonth_v', bodyParser.json(), function (req, res) {
sql = sql.replace(new RegExp("target_increment",'g'),req.body.amount); sql = sql.replace(new RegExp("target_increment",'g'),req.body.amount);
sql = sql.replace(new RegExp("target_month",'g'),req.body.month); sql = sql.replace(new RegExp("target_month",'g'),req.body.month);
sql = sql.replace(new RegExp("replace_version",'g'),req.body.scenario.version); sql = sql.replace(new RegExp("replace_version",'g'),req.body.scenario.version);
sql = sql.replace(new RegExp("replace_iteration",'g'),"tool volume"); sql = sql.replace(new RegExp("replace_iteration",'g'),req.body.iter);
sql = sql.replace(new RegExp("replace_iterdet",'g'),"addmonth_vd");
sql = sql.replace(new RegExp("replace_iterdef",'g'),JSON.stringify(req.body)); sql = sql.replace(new RegExp("replace_iterdef",'g'),JSON.stringify(req.body));
//console.log(sql); //console.log(sql);
console.log(sql) console.log(sql)
@ -184,8 +183,7 @@ server.post('/addmonth_vp', bodyParser.json(), function (req, res) {
sql = sql.replace(new RegExp("target_price",'g'),req.body.amount); sql = sql.replace(new RegExp("target_price",'g'),req.body.amount);
sql = sql.replace(new RegExp("target_month",'g'),req.body.month); sql = sql.replace(new RegExp("target_month",'g'),req.body.month);
sql = sql.replace(new RegExp("replace_version",'g'),req.body.scenario.version); sql = sql.replace(new RegExp("replace_version",'g'),req.body.scenario.version);
sql = sql.replace(new RegExp("replace_iteration",'g'),"tool volume and price"); sql = sql.replace(new RegExp("replace_iteration",'g'),req.body.iter);
sql = sql.replace(new RegExp("replace_iterdet",'g'),"addmonth_vupd");
sql = sql.replace(new RegExp("replace_iterdef",'g'),JSON.stringify(req.body)); sql = sql.replace(new RegExp("replace_iterdef",'g'),JSON.stringify(req.body));
//console.log(sql); //console.log(sql);
Postgres.FirstRow(sql,[],res) Postgres.FirstRow(sql,[],res)
@ -225,8 +223,7 @@ server.post('/scale_v', bodyParser.json(), function (req, res) {
sql = sql.replace(new RegExp("where_clause",'g'),w); sql = sql.replace(new RegExp("where_clause",'g'),w);
sql = sql.replace(new RegExp("target_increment",'g'),req.body.amount); sql = sql.replace(new RegExp("target_increment",'g'),req.body.amount);
sql = sql.replace(new RegExp("replace_version",'g'),req.body.scenario.version); sql = sql.replace(new RegExp("replace_version",'g'),req.body.scenario.version);
sql = sql.replace(new RegExp("replace_iteration",'g'),"tool volume"); sql = sql.replace(new RegExp("replace_iteration",'g'),req.body.iter);
sql = sql.replace(new RegExp("replace_iterdet",'g'),"scale_v");
sql = sql.replace(new RegExp("replace_iterdef",'g'),JSON.stringify(req.body)); sql = sql.replace(new RegExp("replace_iterdef",'g'),JSON.stringify(req.body));
//console.log(sql); //console.log(sql);
Postgres.FirstRow(sql,[],res) Postgres.FirstRow(sql,[],res)
@ -266,8 +263,7 @@ server.post('/scale_p', bodyParser.json(), function (req, res) {
sql = sql.replace(new RegExp("where_clause",'g'),w); sql = sql.replace(new RegExp("where_clause",'g'),w);
sql = sql.replace(new RegExp("target_increment",'g'),req.body.amount); sql = sql.replace(new RegExp("target_increment",'g'),req.body.amount);
sql = sql.replace(new RegExp("replace_version",'g'),req.body.scenario.version); sql = sql.replace(new RegExp("replace_version",'g'),req.body.scenario.version);
sql = sql.replace(new RegExp("replace_iteration",'g'),"tool price"); sql = sql.replace(new RegExp("replace_iteration",'g'),req.body.iter);
sql = sql.replace(new RegExp("replace_iterdet",'g'),"scale_p");
sql = sql.replace(new RegExp("replace_iterdef",'g'),JSON.stringify(req.body)); sql = sql.replace(new RegExp("replace_iterdef",'g'),JSON.stringify(req.body));
//console.log(sql); //console.log(sql);
Postgres.FirstRow(sql,[],res) Postgres.FirstRow(sql,[],res)
@ -308,8 +304,7 @@ server.post('/scale_vp', bodyParser.json(), function (req, res) {
sql = sql.replace(new RegExp("target_vol",'g'),req.body.qty); sql = sql.replace(new RegExp("target_vol",'g'),req.body.qty);
sql = sql.replace(new RegExp("target_prc",'g'),req.body.amount); sql = sql.replace(new RegExp("target_prc",'g'),req.body.amount);
sql = sql.replace(new RegExp("replace_version",'g'),req.body.scenario.version); sql = sql.replace(new RegExp("replace_version",'g'),req.body.scenario.version);
sql = sql.replace(new RegExp("replace_iteration",'g'),"tool volume and price"); sql = sql.replace(new RegExp("replace_iteration",'g'),req.body.iter);
sql = sql.replace(new RegExp("replace_iterdet",'g'),"scale_vp");
sql = sql.replace(new RegExp("replace_iterdef",'g'),JSON.stringify(req.body)); sql = sql.replace(new RegExp("replace_iterdef",'g'),JSON.stringify(req.body));
//console.log(sql); //console.log(sql);
Postgres.FirstRow(sql,[],res) Postgres.FirstRow(sql,[],res)

View File

@ -15,6 +15,6 @@
"tar_qty": 18623740, "tar_qty": 18623740,
"stamp": "2019-03-01 10:00:00", "stamp": "2019-03-01 10:00:00",
"user": "Trowbridge, Paul", "user": "Trowbridge, Paul",
"type": "scale_vp", "source": "forecast ui",
"source": "forecast ui" "type":"scale_v"
} }

View File

@ -395,7 +395,7 @@ SELECT
,make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag adj_requestdate ,make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag adj_requestdate
,make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag + slag adj_shipdate ,make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag + slag adj_shipdate
,'replace_version' "version" --calculated ,'replace_version' "version" --calculated
,'replace_iteration' iter --calculated ,'replace_source'||' volume' iter --calculated
-----------------------ui columns-------------------------------- -----------------------ui columns--------------------------------
,'replace_iterdet' iterdet ,'replace_iterdet' iterdet
,$$replace_iterdef$$::jsonb iterdef ,$$replace_iterdef$$::jsonb iterdef

View File

@ -392,7 +392,7 @@ SELECT
,make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag adj_requestdate ,make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag adj_requestdate
,make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag + slag adj_shipdate ,make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag + slag adj_shipdate
,'replace_version' "version" --calculated ,'replace_version' "version" --calculated
,'replace_iteration' iter --calculated ,'replace_source'||' volume' iter
-----------------------ui columns-------------------------------- -----------------------ui columns--------------------------------
,'replace_iterdet' iterdet ,'replace_iterdet' iterdet
,$$replace_iterdef$$::jsonb iterdef ,$$replace_iterdef$$::jsonb iterdef

View File

@ -273,7 +273,7 @@ SELECT
,b.adj_requestdate ,b.adj_requestdate
,b.adj_shipdate ,b.adj_shipdate
,'replace_version' "version" --calculated ,'replace_version' "version" --calculated
,'replace_iteration' "b.iter" --calculated ,'replace_source'||' price' iter --calculated
-----------------------ui columns-------------------------------- -----------------------ui columns--------------------------------
,'replace_iterdet' iterdet ,'replace_iterdet' iterdet
,$$replace_iterdef$$::jsonb iterdef ,$$replace_iterdef$$::jsonb iterdef

View File

@ -273,7 +273,7 @@ SELECT
,b.adj_requestdate ,b.adj_requestdate
,b.adj_shipdate ,b.adj_shipdate
,'replace_version' "version" --calculated ,'replace_version' "version" --calculated
,'replace_iteration' iter --calculated ,'replace_source'||' volume' iter
-----------------------ui columns-------------------------------- -----------------------ui columns--------------------------------
,'replace_iterdet' iterdet ,'replace_iterdet' iterdet
,$$replace_iterdef$$::jsonb iterdef ,$$replace_iterdef$$::jsonb iterdef

View File

@ -274,7 +274,7 @@ target AS (select target_vol vincr, target_prc pincr)
,b.adj_requestdate ,b.adj_requestdate
,b.adj_shipdate ,b.adj_shipdate
,'replace_version' "version" --calculated ,'replace_version' "version" --calculated
,'replace_iteration' iter --calculated ,'replace_source'||' volume' iter
-----------------------ui columns-------------------------------- -----------------------ui columns--------------------------------
,'replace_iterdet' iterdet ,'replace_iterdet' iterdet
,$$replace_iterdef$$::jsonb iterdef ,$$replace_iterdef$$::jsonb iterdef