From c97e92f3bcc524ba9d3c671ec70cdcae090bbb05 Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Sun, 3 Apr 2022 01:18:14 -0400 Subject: [PATCH] remove single quotes from open order status since they shoudl be supplied by the request, and couple more quoted identifiers --- routes/baseline/gen_baseline.sql | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/routes/baseline/gen_baseline.sql b/routes/baseline/gen_baseline.sql index 46d030d..9bebc34 100644 --- a/routes/baseline/gen_baseline.sql +++ b/routes/baseline/gen_baseline.sql @@ -107,7 +107,7 @@ WHERE --base period orders booked.... $$||format('%I',_order_date)||$$ BETWEEN 'app_baseline_from_date'::date AND 'app_baseline_to_date'::date --...or any open orders currently booked before cutoff.... - OR ($$||format('%I',_order_status)||$$ IN ('app_openstatus_code') and $$||format('%I',_order_date)||$$ <= 'app_openorder_cutoff'::date) + OR ($$||format('%I',_order_status)||$$ IN (app_openstatus_code) and $$||format('%I',_order_date)||$$ <= 'app_openorder_cutoff'::date) --...or anything that shipped in that period OR ($$||format('%I',_ship_date)||$$ BETWEEN 'app_baseline_from_date'::date AND 'app_baseline_to_date'::date) ) @@ -130,7 +130,7 @@ $$ FROM fc.live o$$||E'\n'||_perd_joins||$$ WHERE - $$||_order_date||$$ BETWEEN 'app_plug_fromdate'::date AND 'app_plug_todate'::date + $$||format('%I',_order_date)||$$ BETWEEN 'app_plug_fromdate'::date AND 'app_plug_todate'::date --be sure to pre-exclude unwanted items, like canceled orders, non-gross sales, and short-ships $$ INTO @@ -158,8 +158,8 @@ SELECT FROM incr i WHERE - i.$$||_order_date||$$ >= 'app_first_forecast_date'::date$$||$$ - OR i.$$||_ship_date||$$ >= 'app_first_forecast_date'::date$$||$$ + i.$$||format('%I',_order_date)||$$ >= 'app_first_forecast_date'::date$$||$$ + OR i.$$||format('%I',_ship_date)||$$ >= 'app_first_forecast_date'::date$$||$$ RETURNING * ) SELECT COUNT(*) num_rows FROM ins$$