show bridge to normalize last price

This commit is contained in:
Paul Trowbridge 2025-08-11 21:18:22 -04:00
parent a649924c86
commit f936b9d31d

View File

@ -464,6 +464,26 @@ BEGIN
ELSE NULL END ELSE NULL END
) )
) )
-- ||CASE WHEN _last_premium IS NOT NULL THEN
||COALESCE(jsonb_build_array(jsonb_build_object(
'label','Price Difference',
'value', _last_premium,
'type','percent',
'note', _last_premium_method
)),'[]'::jsonb)
-- ELSE
-- '[]'::jsonb
-- END
-- ||CASE WHEN _last_premium IS NOT NULL THEN
||COALESCE(jsonb_build_array(jsonb_build_object(
'label','Adjusted Price',
'value', _last_price_norm,
'type','currency',
'note','normalized to ' || _v1ds
)),'[]'::jsonb)
-- ELSE
-- '[]'::jsonb
-- END
), ),
------------------------------------------ ------------------------------------------
-- price list -- price list
@ -515,9 +535,9 @@ BEGIN
ELSE '' END ELSE '' END
) )
) )
FROM jsonb_array_elements_text(COALESCE(_tmath,'{}'::jsonb)) ae FROM jsonb_array_elements_text(COALESCE(_tmath,'[""]'::jsonb)) ae
) )
||jsonb_build_object('label','Price','value',_tprice,'type','currency','note','Total') ||CASE WHEN _tprice IS NULL THEN '[]'::jsonb ELSE jsonb_build_object('label','Price','value',COALESCE(_tprice,0),'type','currency','note','Total') END
-- ) -- )
), ),
------------------------------------------ ------------------------------------------
@ -528,9 +548,9 @@ BEGIN
'details', jsonb_build_array( 'details', jsonb_build_array(
jsonb_build_object( jsonb_build_object(
'label', 'Price', 'label', 'Price',
'value', _guidance_price, 'value', COALESCE(_guidance_price,0),
'type', 'currency', 'type', 'currency',
'note', _guidance_reason 'note', COALESCE(_guidance_reason,'')
) )
) )
) )