This commit is contained in:
Trowbridge 2019-03-13 13:24:34 -04:00
parent e649fd84e0
commit c1ee6134d8

View File

@ -127,12 +127,21 @@ server.post('/addmonth_v', bodyParser.json(), function (req, res) {
var d = 1; //counts cycles in scenario key values which are arrays var d = 1; //counts cycles in scenario key values which are arrays
var args = []; var args = [];
var path = './route_sql/addmonth_vd.sql'; var path = './route_sql/addmonth_vd.sql';
fs.readFile(path, 'utf8', function(err, data){
if (!err){
callback(data);
} else {
console.log("fatal error pulling sql file")
callback(err);
}
});
var callback = function(arg){ var callback = function(arg){
sql = arg; sql = arg;
//buile where clause expression //buile where clause expression
({ c, w, d } = build_where(req, c, w, d, args)); ({ c, w, d } = build_where(req, c, w, d, args));
if (c == 1) { if (c == 1) {
res.send("no body was sent"); res.send("no body was sent");
return; return;
@ -151,15 +160,6 @@ server.post('/addmonth_v', bodyParser.json(), function (req, res) {
console.log(sql) console.log(sql)
Postgres.FirstRow(sql,[],res) Postgres.FirstRow(sql,[],res)
} }
fs.readFile(path, 'utf8', function(err, data){
if (!err){
callback(data);
} else {
console.log("fatal error pulling sql file")
callback(err);
}
});
}) })
server.post('/addmonth_vp', bodyParser.json(), function (req, res) { server.post('/addmonth_vp', bodyParser.json(), function (req, res) {