diff --git a/src/sql/0-run-first/billing.sql b/src/sql/0-run-first/billing.sql index caaea6c..be241cc 100644 --- a/src/sql/0-run-first/billing.sql +++ b/src/sql/0-run-first/billing.sql @@ -14,11 +14,10 @@ where invoice_accepted = 1; CREATE INDEX ref_num ON billing_report (refNumber); CREATE INDEX div_idx ON billing_report (division); -# So this little ditty will replace the raw project_type info with a prettified string. Only problem is it takes more than -# 10 minutes to run on our t3a.micro ec2 instance. -# UPDATE billing_report -# SET division = IF( -# division = 'Warranty', -# CONCAT(SUBSTRING(refNumber, 1, 3), ' - ', 'Structural'), -# CONCAT(SUBSTRING(refNumber, 1, 3), ' - ', division) -# ); + + UPDATE billing_report + SET division = IF( + division = 'Warranty', + CONCAT(SUBSTRING(refNumber, 1, 3), ' - ', 'Structural'), + CONCAT(SUBSTRING(refNumber, 1, 3), ' - ', division) + ); diff --git a/src/sql/0-run-first/lifecycle.sql b/src/sql/0-run-first/lifecycle.sql index 9606917..efcafb6 100644 --- a/src/sql/0-run-first/lifecycle.sql +++ b/src/sql/0-run-first/lifecycle.sql @@ -2,7 +2,7 @@ DROP TABLE IF EXISTS event_counts; CREATE TABLE event_counts AS SELECT DATE(timestamp) AS event_date, - get_division_collapsed(project_number) AS division, + all_projects.proj_type AS division_raw, if(substring(new_value, 1, 1) = '+', 1, -1) AS event_count, SUBSTRING(`new_value` FROM 2) AS flag FROM project_lifecycle