vault backup: 2023-11-20 15:56:18
This commit is contained in:
parent
14ee797b91
commit
062cea58a6
@ -116,6 +116,11 @@ export function apply_guidance(doc: any) {
|
||||
let guidance = {
|
||||
prices
|
||||
,finalPrice
|
||||
,targetPrice
|
||||
,listUSD
|
||||
,ltp
|
||||
,inflationFactor
|
||||
,optimization
|
||||
}
|
||||
doc.guidance = guidance;
|
||||
return doc;
|
||||
|
@ -60,8 +60,6 @@ AS $function$
|
||||
return result.toLocaleString('en-US', {minimumFractionDigits: 2, maximumFractionDigits: 2});
|
||||
}
|
||||
|
||||
console.log(doc);
|
||||
|
||||
// --------------------extract incoming data------------------------------------------------------
|
||||
const targetPrice = doc.pricing?.v1tp ?? doc.pricing?.v0tp;
|
||||
const priceBand = doc.pricing?.v1stdv ?? doc.pricing?.v0stdv;
|
||||
@ -81,7 +79,6 @@ AS $function$
|
||||
const inflationFactor = iidx ? iidx[inflation] : 0;
|
||||
const list = doc.pricing?.list && doc.product?.itemrel === "2" ? doc.pricing?.list : null;
|
||||
const listUSD = list ? list * fxrate :null;
|
||||
const fstdUSD = doc.product?.std;
|
||||
|
||||
// ------------------calculate price adders------------------------------------------------------
|
||||
let ltp = qty < pltq ? 0.15 : null;
|
||||
@ -124,7 +121,9 @@ AS $function$
|
||||
,finalPrice
|
||||
,targetPrice
|
||||
,listUSD
|
||||
,fstdUSD
|
||||
,ltp
|
||||
,inflationFactor
|
||||
,optimization
|
||||
}
|
||||
doc.guidance = guidance;
|
||||
return doc;
|
||||
|
@ -17,6 +17,9 @@ lq AS MATERIALIZED (
|
||||
,(pricing->'guidance'->'finalPrice'->>'Price')::numeric guidance
|
||||
,pricing->'guidance'->'finalPrice'->>'Reason' reason
|
||||
,(pricing->'product'->>'fstd_usd')::numeric fstd_usd
|
||||
,(pricing->'guidance'->>'ltp')::numeric ltp
|
||||
,(pricing->'guidance'->>'optimization')::numeric optimization
|
||||
,(pricing->'guidance'->>'inflationFactor')::numeric inflation
|
||||
,jsonb_pretty(pricing) pricing
|
||||
FROM
|
||||
lq
|
||||
|
Loading…
Reference in New Issue
Block a user