update sql and route type, successful calls

This commit is contained in:
Trowbridge 2019-03-12 17:32:28 -04:00
parent 1ecadc3227
commit ed6f88147f
3 changed files with 5 additions and 6 deletions

View File

@ -100,7 +100,7 @@ server.get('/scenario_package', bodyParser.json(), function (req, res) {
return;
}
//parse the where clause into the main sql statement
sql = sql.replace("'where_clause'",w)
sql = sql.replace(new RegExp("where_clause",'g'),w)
//execute the sql and send the result
Postgres.FirstRow(sql,[],res)
};
@ -116,14 +116,14 @@ server.get('/scenario_package', bodyParser.json(), function (req, res) {
})
server.get('/addmonth_v', bodyParser.json(), function (req, res) {
server.post('/addmonth_v', bodyParser.json(), function (req, res) {
var sql = "";
var w = "";
var c = 1;
var args = [];
var path = './route_sql/addmonth_vd.sql';
var callback = function(arg){
sql = arg
@ -149,7 +149,6 @@ server.get('/addmonth_v', bodyParser.json(), function (req, res) {
sql = sql.replace(new RegExp("scenario = target_scenario",'g'),w);
sql = sql.replace(new RegExp("target_increment",'g'),req.body.amount);
sql = sql.replace(new RegExp("target_month",'g'),req.body.month);
console.log(sql);
//console.log(sql);
Postgres.FirstRow(sql,[],res)
}

View File

@ -446,7 +446,7 @@ FROM
LEFT OUTER JOIN gld sd ON
make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag + slag BETWEEN sd.sdat AND sd.edat
WHERE
m._month = 'target_month'
m._month = (SELECT _month FROM closest)
)
, ins AS (
INSERT INTO rlarp.osm_fcpool SELECT * FROM final RETURNING *

View File

@ -35,7 +35,7 @@ SELECT
FROM
rlarp.osm_fcpool
WHERE
'where_clause'
where_clause
GROUP BY
order_season
,order_month