From 932c95e83ccc0503074f4a329ade5d5b0f1d12f4 Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Thu, 14 Mar 2019 10:47:29 -0400 Subject: [PATCH] dont use iterdet anymore since not in osm. iter = source + behavior --- index.js | 17 ++++++----------- route_meta/adjust.json | 4 ++-- route_sql/addmonth_vd.sql | 2 +- route_sql/addmonth_vupd.sql | 2 +- route_sql/scale_pd.sql | 2 +- route_sql/scale_vd.sql | 2 +- route_sql/scale_vupd.sql | 2 +- 7 files changed, 13 insertions(+), 18 deletions(-) diff --git a/index.js b/index.js index 52c37a3..3bb4d82 100644 --- a/index.js +++ b/index.js @@ -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')) @@ -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_month",'g'),req.body.month); 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_iterdet",'g'),"addmonth_vd"); + sql = sql.replace(new RegExp("replace_iteration",'g'),req.body.iter); sql = sql.replace(new RegExp("replace_iterdef",'g'),JSON.stringify(req.body)); //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_month",'g'),req.body.month); 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_iterdet",'g'),"addmonth_vupd"); + sql = sql.replace(new RegExp("replace_iteration",'g'),req.body.iter); sql = sql.replace(new RegExp("replace_iterdef",'g'),JSON.stringify(req.body)); //console.log(sql); 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("target_increment",'g'),req.body.amount); 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_iterdet",'g'),"scale_v"); + sql = sql.replace(new RegExp("replace_iteration",'g'),req.body.iter); sql = sql.replace(new RegExp("replace_iterdef",'g'),JSON.stringify(req.body)); //console.log(sql); 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("target_increment",'g'),req.body.amount); 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_iterdet",'g'),"scale_p"); + sql = sql.replace(new RegExp("replace_iteration",'g'),req.body.iter); sql = sql.replace(new RegExp("replace_iterdef",'g'),JSON.stringify(req.body)); //console.log(sql); 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_prc",'g'),req.body.amount); 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_iterdet",'g'),"scale_vp"); + sql = sql.replace(new RegExp("replace_iteration",'g'),req.body.iter); sql = sql.replace(new RegExp("replace_iterdef",'g'),JSON.stringify(req.body)); //console.log(sql); Postgres.FirstRow(sql,[],res) diff --git a/route_meta/adjust.json b/route_meta/adjust.json index 7c24978..7f30995 100644 --- a/route_meta/adjust.json +++ b/route_meta/adjust.json @@ -15,6 +15,6 @@ "tar_qty": 18623740, "stamp": "2019-03-01 10:00:00", "user": "Trowbridge, Paul", - "type": "scale_vp", - "source": "forecast ui" + "source": "forecast ui", + "type":"scale_v" } \ No newline at end of file diff --git a/route_sql/addmonth_vd.sql b/route_sql/addmonth_vd.sql index e885e3c..1277fbb 100644 --- a/route_sql/addmonth_vd.sql +++ b/route_sql/addmonth_vd.sql @@ -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 + slag adj_shipdate ,'replace_version' "version" --calculated - ,'replace_iteration' iter --calculated + ,'replace_source'||' volume' iter --calculated -----------------------ui columns-------------------------------- ,'replace_iterdet' iterdet ,$$replace_iterdef$$::jsonb iterdef diff --git a/route_sql/addmonth_vupd.sql b/route_sql/addmonth_vupd.sql index 10739c3..ee56eab 100644 --- a/route_sql/addmonth_vupd.sql +++ b/route_sql/addmonth_vupd.sql @@ -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 + slag adj_shipdate ,'replace_version' "version" --calculated - ,'replace_iteration' iter --calculated + ,'replace_source'||' volume' iter -----------------------ui columns-------------------------------- ,'replace_iterdet' iterdet ,$$replace_iterdef$$::jsonb iterdef diff --git a/route_sql/scale_pd.sql b/route_sql/scale_pd.sql index 0844c96..81145bc 100644 --- a/route_sql/scale_pd.sql +++ b/route_sql/scale_pd.sql @@ -273,7 +273,7 @@ SELECT ,b.adj_requestdate ,b.adj_shipdate ,'replace_version' "version" --calculated - ,'replace_iteration' "b.iter" --calculated + ,'replace_source'||' price' iter --calculated -----------------------ui columns-------------------------------- ,'replace_iterdet' iterdet ,$$replace_iterdef$$::jsonb iterdef diff --git a/route_sql/scale_vd.sql b/route_sql/scale_vd.sql index e6ea932..8148cf3 100644 --- a/route_sql/scale_vd.sql +++ b/route_sql/scale_vd.sql @@ -273,7 +273,7 @@ SELECT ,b.adj_requestdate ,b.adj_shipdate ,'replace_version' "version" --calculated - ,'replace_iteration' iter --calculated + ,'replace_source'||' volume' iter -----------------------ui columns-------------------------------- ,'replace_iterdet' iterdet ,$$replace_iterdef$$::jsonb iterdef diff --git a/route_sql/scale_vupd.sql b/route_sql/scale_vupd.sql index 1fe80e2..e072aba 100644 --- a/route_sql/scale_vupd.sql +++ b/route_sql/scale_vupd.sql @@ -274,7 +274,7 @@ target AS (select target_vol vincr, target_prc pincr) ,b.adj_requestdate ,b.adj_shipdate ,'replace_version' "version" --calculated - ,'replace_iteration' iter --calculated + ,'replace_source'||' volume' iter -----------------------ui columns-------------------------------- ,'replace_iterdet' iterdet ,$$replace_iterdef$$::jsonb iterdef