prevent last price iteration from being available to delete, and rebuild price iteration to only look at baseline activity

This commit is contained in:
Paul Trowbridge 2021-04-12 15:10:45 -04:00
parent 3b3b01bb90
commit 50da4dfa17
2 changed files with 4 additions and 2 deletions

View File

@ -332,6 +332,8 @@ WHERE
AND o.units <> 0 AND o.units <> 0
---only apply to 2022 orders---- ---only apply to 2022 orders----
AND o.order_date >= '2021-06-01' AND o.order_date >= '2021-06-01'
--only include baseline stuff---
AND iter IN ('actuals','copy','actuals_plug')
) )
-----------aggregate the impact------------ -----------aggregate the impact------------
--SELECT * FROM ins limit 10000 --SELECT * FROM ins limit 10000

View File

@ -15,7 +15,7 @@ from
id = logid id = logid
WHERE WHERE
quota_rep_descr = 'replace_user' quota_rep_descr = 'replace_user'
AND tag <> 'Initial Build' AND tag NOT IN ('Initial Build','last price')
group BY group BY
ol.doc->>'user' ol.doc->>'user'
,quota_rep_descr ,quota_rep_descr
@ -28,4 +28,4 @@ ORDER BY
(ol.doc->>'stamp')::timestamptz desc (ol.doc->>'stamp')::timestamptz desc
) )
SELECT SELECT
jsonb_agg(row_to_json(agg)::jsonb ORDER BY agg.stamp desc) x from agg jsonb_agg(row_to_json(agg)::jsonb ORDER BY agg.stamp desc) x from agg