diff --git a/README.md b/README.md index b54cf56..c66d661 100644 --- a/README.md +++ b/README.md @@ -7,4 +7,21 @@ Special concepts Slowness Options * move json to a separate table and the change can be marked with a sequence * have the data actually be a query from the database -* reduce number of columns in fc_pool \ No newline at end of file +* reduce number of columns in fc_pool + +Discussion +* special look at Mar-Apr sales since it is being copied from plan or older data + - [ ] at the end of March, we will swap out the budget from March with actuals and re-forecast + - [ ] need to think through how to overlay actuals into the budget +* last price paid snap - preload + - [ ] dont do this +* FX - currently nothing loaded + - [ ] we'll pick one (see Bruno) +* cost - snap to current cost + - [ ] snap to current +* need to be able to reload the forecast as we lock in new months of sales data - replay changes over top? + * item 1 +* refresh new part list +* add comments on monthly +* add a tag that is separate from the comment? +* need to test extrapolating osm_pool into osmp_dev \ No newline at end of file diff --git a/route_sql/build/build_fcpool.sql b/route_sql/build/build_fcpool.sql index 457a02a..0ddcdcd 100644 --- a/route_sql/build/build_fcpool.sql +++ b/route_sql/build/build_fcpool.sql @@ -131,7 +131,7 @@ FROM ) WITH DATA; CREATE INDEX osm_qr ON rlarp.osm_pool(quota_rep_descr); - +ALTER TABLE rlarp.osm_pool ADD CONSTRAINT logfk FOREIGN KEY (logid) REFERENCES rlarp.osm_log(id); DROP TABLE IF EXISTS rlarp.osm_log; diff --git a/route_sql/scenario_package.sql b/route_sql/scenario_package.sql index 4e988fa..ca83043 100644 --- a/route_sql/scenario_package.sql +++ b/route_sql/scenario_package.sql @@ -142,6 +142,19 @@ GROUP BY ,version ,iter ) +,tags AS ( + SELECT DISTINCT + doc->>'tag' tag + FROM + rlarp.osm_log + WHERE doc ? 'tag' + UNION + SELECT * FROM + (VALUES + ('price'), + ('volume') + ) x(tag) +) SELECT jsonb_build_object( 'months' @@ -152,4 +165,6 @@ SELECT ,(SELECT jsonb_agg(row_to_json(basket)::jsonb) FROM basket) ,'totals' ,(SELECT jsonb_agg(row_to_json(totals)::jsonb) FROM totals) + ,'tags' + ,(SELECT jsonb_agg(tag) FROM tags) ) package \ No newline at end of file