From 193b489e629f1d72dbeb575552a317e1b375e730 Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Tue, 7 Nov 2023 01:34:18 -0500 Subject: [PATCH] vault backup: 2023-11-07 01:34:18 --- api.ts | 2 +- sql/get_guidance.pg.sql | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/api.ts b/api.ts index 4337a43..2b5b547 100644 --- a/api.ts +++ b/api.ts @@ -175,7 +175,7 @@ router.get('/code_price/:billcode/:shipcode/:partcode/:qty', async (ctx) => { //console.log(customer) const result = await client.queryObject({args: [billcode, shipcode, partcode, qty], text: query} ); const procd = apply_guidance(result.rows[0]["doc"]) - ctx.response.body = procd + ctx.response.body = procd; }); app.use(router.routes()); diff --git a/sql/get_guidance.pg.sql b/sql/get_guidance.pg.sql index 3db46c9..cf06353 100644 --- a/sql/get_guidance.pg.sql +++ b/sql/get_guidance.pg.sql @@ -44,7 +44,7 @@ BEGIN i.item = _item; --RAISE NOTICE 'mold %', _mold; --RAISE NOTICE 'v1ds %', _v1ds; - _rslt := jsonb_build_object('mold',_mold,'v1ds',_v1ds,'v0ds',_v0ds)||_iidx; + _rslt := jsonb_build_object('mold',_mold,'v1ds',_v1ds,'v0ds',_v0ds,'stlc',_stlc)||_iidx; ----------------channel------------------------------------- @@ -62,6 +62,23 @@ BEGIN SELECT _rslt||jsonb_build_object('hist',rlarp.gethist(_mold, _cust)) INTO _rslt ; --RAISE NOTICE '%', _rslt; + ----------------target pricing------------------------------ + SELECT + jsonb_build_object( + 'v0tp', + target_price, + 'stdv', + stdev_price + ) + INTO + _targ + FROM + pricequote.market_setavgprice + WHERE + mold = _stlc + AND season = _seas + AND data_segment = _v0ds + AND region = 'ALL'; ----------------target pricing------------------------------ SELECT jsonb_build_object(