clean up
This commit is contained in:
parent
924bb21b48
commit
2d037b567f
53
index.js
53
index.js
@ -30,59 +30,6 @@ Postgres.FirstRow = function (inSQL, args, inResponse) {
|
||||
});
|
||||
};
|
||||
|
||||
server.get('/scenario_totals', bodyParser.json(), function (req, res) {
|
||||
|
||||
var w = "";
|
||||
var c = 1;
|
||||
var args = [];
|
||||
|
||||
for (var i in req.body) {
|
||||
//console.log(i);
|
||||
///console.log(req.body[i]);
|
||||
if (c > 1) {
|
||||
w = w +
|
||||
`
|
||||
AND `
|
||||
}
|
||||
w = w + i + " = '" + req.body[i] + "'";
|
||||
args.push(req.body[i]);
|
||||
c = c + 1;
|
||||
};
|
||||
if (c == 1) {
|
||||
res.send("no body was sent");
|
||||
return;
|
||||
}
|
||||
//console.log(w);
|
||||
//console.log(args);
|
||||
w =
|
||||
`
|
||||
WITH
|
||||
ini AS (
|
||||
SELECT
|
||||
order_season
|
||||
,version
|
||||
,iter
|
||||
,SUM(units) units
|
||||
,SUM(value_usd) value_usd
|
||||
FROM
|
||||
rlarp.osm_fcpool
|
||||
WHERE
|
||||
` + w +
|
||||
`
|
||||
GROUP BY
|
||||
order_season
|
||||
,version
|
||||
,iter
|
||||
)
|
||||
SELECT
|
||||
jsonb_agg(row_to_json(ini)::jsonb) x
|
||||
FROM
|
||||
ini`
|
||||
console.log(w);
|
||||
Postgres.FirstRow(w, [], res)
|
||||
//res.json("hi")
|
||||
})
|
||||
|
||||
server.get('/scenario_package', bodyParser.json(), function (req, res) {
|
||||
|
||||
var w = "";
|
||||
|
@ -1,32 +0,0 @@
|
||||
SELECT
|
||||
version
|
||||
,bill_cust
|
||||
,ship_cust
|
||||
,part
|
||||
,promo
|
||||
,terms
|
||||
,plnt
|
||||
,r_currency
|
||||
,c_currency
|
||||
,requestdate - orderdate rdiff
|
||||
,shipdate - requestdate sdiff
|
||||
,sum(fb_qty) fb_qty
|
||||
,sum(fb_val_loc) fb_val_loc
|
||||
,sum(fb_cst_loc) fb_cst_loc
|
||||
FROM
|
||||
rlarp.osm
|
||||
WHERE
|
||||
|
||||
AND calc_status <> 'CANCELED'
|
||||
GROUP BY
|
||||
version
|
||||
,bill_cust
|
||||
,ship_cust
|
||||
,part
|
||||
,promo
|
||||
,terms
|
||||
,plnt
|
||||
,r_currency
|
||||
,c_currency
|
||||
,requestdate - orderdate
|
||||
,shipdate - requestdate
|
@ -1,30 +0,0 @@
|
||||
Functional Isolation Level
|
||||
```
|
||||
|
||||
+------------------+
|
||||
+------> Application |
|
||||
| | |
|
||||
| | 📃 local changes +-+
|
||||
| | | |
|
||||
| +------------------+ |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
+------------+-------------+ +------v----------------+
|
||||
|📃 Frozen Snapshot | |📃 persisted changes |
|
||||
+---------^----------^-----+ +------+----------------+
|
||||
| | |
|
||||
| | |
|
||||
| | |
|
||||
| | |
|
||||
| | |
|
||||
+---------+------+ | +-------v-------+
|
||||
|🔨 Setup Forecast| +-----------+🔨 materialize |
|
||||
+--^---------^---+ +-------+-------+
|
||||
| | |
|
||||
| | |
|
||||
+-------------+---+ +--+-----------------+ |
|
||||
|Main History(OSM)| |Main Foreast(OSMF) <---------+
|
||||
+-----------------+ +--------------------+
|
||||
|
||||
```
|
@ -1,4 +0,0 @@
|
||||
{
|
||||
"quota_rep": "person",
|
||||
"segment": "greenhoues"
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
|
||||
SELECT
|
||||
oseas
|
||||
,extract('month' from odate) month
|
||||
,sum(fb_qty) fb_qty
|
||||
,sum(fb_val_loc) fb_val_loc
|
||||
,sum(fb_cst_loc) fb_cst_loc
|
||||
FROM
|
||||
rlarp.osm_ppfa_varto_mv
|
||||
WHERE
|
||||
|
||||
AND calc_status <> 'CANCELED'
|
||||
GROUP BY
|
||||
oseas
|
||||
,extract('month' from odate)
|
Loading…
Reference in New Issue
Block a user