update sql and route type, successful calls
This commit is contained in:
parent
1ecadc3227
commit
ed6f88147f
5
index.js
5
index.js
@ -100,7 +100,7 @@ server.get('/scenario_package', bodyParser.json(), function (req, res) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//parse the where clause into the main sql statement
|
//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
|
//execute the sql and send the result
|
||||||
Postgres.FirstRow(sql,[],res)
|
Postgres.FirstRow(sql,[],res)
|
||||||
};
|
};
|
||||||
@ -116,7 +116,7 @@ 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 sql = "";
|
||||||
var w = "";
|
var w = "";
|
||||||
@ -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("scenario = target_scenario",'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("target_month",'g'),req.body.month);
|
sql = sql.replace(new RegExp("target_month",'g'),req.body.month);
|
||||||
console.log(sql);
|
|
||||||
//console.log(sql);
|
//console.log(sql);
|
||||||
Postgres.FirstRow(sql,[],res)
|
Postgres.FirstRow(sql,[],res)
|
||||||
}
|
}
|
||||||
|
@ -446,7 +446,7 @@ FROM
|
|||||||
LEFT OUTER JOIN gld sd ON
|
LEFT OUTER JOIN gld sd ON
|
||||||
make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag + slag BETWEEN sd.sdat AND sd.edat
|
make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag + slag BETWEEN sd.sdat AND sd.edat
|
||||||
WHERE
|
WHERE
|
||||||
m._month = 'target_month'
|
m._month = (SELECT _month FROM closest)
|
||||||
)
|
)
|
||||||
, ins AS (
|
, ins AS (
|
||||||
INSERT INTO rlarp.osm_fcpool SELECT * FROM final RETURNING *
|
INSERT INTO rlarp.osm_fcpool SELECT * FROM final RETURNING *
|
||||||
|
@ -35,7 +35,7 @@ SELECT
|
|||||||
FROM
|
FROM
|
||||||
rlarp.osm_fcpool
|
rlarp.osm_fcpool
|
||||||
WHERE
|
WHERE
|
||||||
'where_clause'
|
where_clause
|
||||||
GROUP BY
|
GROUP BY
|
||||||
order_season
|
order_season
|
||||||
,order_month
|
,order_month
|
||||||
|
Loading…
Reference in New Issue
Block a user