Created
May 17, 2019 04:32
-
-
Save sminnee/6a0cadcae75fbdc5658a2bed68a1c4f9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/ss_dbt/models/platform/github_metrics.sql b/ss_dbt/models/platform/github_metrics.sql | |
index 2c230fa..3bcb334 100644 | |
--- a/ss_dbt/models/platform/github_metrics.sql | |
+++ b/ss_dbt/models/platform/github_metrics.sql | |
@@ -21,6 +21,15 @@ SELECT | |
coalesce(prs_created, 0) AS prs_created, | |
coalesce(prs_closed, 0) AS prs_closed, | |
+ coalesce(bugs_p1_created, 0) AS bugs_p1_created, | |
+ coalesce(bugs_p1_closed, 0) AS bugs_p1_closed, | |
+ coalesce(bugs_p2_created, 0) AS bugs_p2_created, | |
+ coalesce(bugs_p2_closed, 0) AS bugs_p2_closed, | |
+ coalesce(bugs_p3_created, 0) AS bugs_p3_created, | |
+ coalesce(bugs_p3_closed, 0) AS bugs_p3_closed, | |
+ coalesce(bugs_p4_created, 0) AS bugs_p4_created, | |
+ coalesce(bugs_p4_closed, 0) AS bugs_p4_closed, | |
+ | |
-- Backlog sizes at end of week | |
SUM(COALESCE(issues_created, 0)) OVER (PARTITION BY repos.repository ORDER BY weeks.weeks ASC ROWS BETWEEN unbounded preceding AND CURRENT row) | |
- SUM(COALESCE(issues_closed, 0)) OVER (PARTITION BY repos.repository ORDER BY weeks.weeks ASC ROWS BETWEEN unbounded preceding AND CURRENT row) | |
@@ -58,6 +67,20 @@ SELECT | |
SUM(COALESCE(prs_closed, 0)) OVER (PARTITION BY repos.repository ORDER BY weeks.weeks ASC ROWS BETWEEN unbounded preceding AND CURRENT row) | |
AS prs_total_closed, | |
+ SUM(COALESCE(bugs_p1_created, 0)) OVER (PARTITION BY repos.repository ORDER BY weeks.weeks ASC ROWS BETWEEN unbounded preceding AND CURRENT row) | |
+ - SUM(COALESCE(bugs_p1_closed, 0)) OVER (PARTITION BY repos.repository ORDER BY weeks.weeks ASC ROWS BETWEEN unbounded preceding AND CURRENT row) | |
+ AS bugs_p1_total_open, | |
+ SUM(COALESCE(bugs_p2_created, 0)) OVER (PARTITION BY repos.repository ORDER BY weeks.weeks ASC ROWS BETWEEN unbounded preceding AND CURRENT row) | |
+ - SUM(COALESCE(bugs_p2_closed, 0)) OVER (PARTITION BY repos.repository ORDER BY weeks.weeks ASC ROWS BETWEEN unbounded preceding AND CURRENT row) | |
+ AS bugs_p2_total_open, | |
+ SUM(COALESCE(bugs_p3_created, 0)) OVER (PARTITION BY repos.repository ORDER BY weeks.weeks ASC ROWS BETWEEN unbounded preceding AND CURRENT row) | |
+ - SUM(COALESCE(bugs_p3_closed, 0)) OVER (PARTITION BY repos.repository ORDER BY weeks.weeks ASC ROWS BETWEEN unbounded preceding AND CURRENT row) | |
+ AS bugs_p3_total_open, | |
+ SUM(COALESCE(bugs_p4_created, 0)) OVER (PARTITION BY repos.repository ORDER BY weeks.weeks ASC ROWS BETWEEN unbounded preceding AND CURRENT row) | |
+ - SUM(COALESCE(bugs_p4_closed, 0)) OVER (PARTITION BY repos.repository ORDER BY weeks.weeks ASC ROWS BETWEEN unbounded preceding AND CURRENT row) | |
+ AS bugs_p4_total_open, | |
+ | |
+ | |
gmd.total_triaged, | |
gmd.total_untriaged, | |
gmd.total_partially_triaged, | |
@@ -84,7 +107,11 @@ LEFT JOIN ( | |
count(*) FILTER (WHERE NOT is_pr AND type = 'bug') AS bugs_created, | |
count(*) FILTER (WHERE NOT is_pr AND type = 'enhancement') AS enhancements_created, | |
count(*) FILTER (WHERE NOT is_pr AND type = 'docs') AS docissues_created, | |
- count(*) FILTER (WHERE NOT is_pr AND type IS NULL) AS notype_created | |
+ count(*) FILTER (WHERE NOT is_pr AND type IS NULL) AS notype_created, | |
+ count(*) FILTER (WHERE NOT is_pr AND type = 'bug' and impact = 'critical') AS bugs_p1_created, | |
+ count(*) FILTER (WHERE NOT is_pr AND type = 'bug' and impact = 'high') AS bugs_p2_created, | |
+ count(*) FILTER (WHERE NOT is_pr AND type = 'bug' and impact = 'medium') AS bugs_p3_created, | |
+ count(*) FILTER (WHERE NOT is_pr AND type = 'bug' and impact = 'low') AS bugs_p4_created | |
FROM {{ ref('github_issues') }} | |
GROUP BY 1,2 | |
) created ON created.week = weeks.weeks and repos.repository = created.repository | |
@@ -97,7 +124,11 @@ LEFT JOIN ( | |
count(*) FILTER (WHERE NOT is_pr AND type = 'bug') AS bugs_closed, | |
count(*) FILTER (WHERE NOT is_pr AND type = 'enhancement') AS enhancements_closed, | |
count(*) FILTER (WHERE NOT is_pr AND type = 'docs') AS docissues_closed, | |
- count(*) FILTER (WHERE NOT is_pr AND type IS NULL) AS notype_closed | |
+ count(*) FILTER (WHERE NOT is_pr AND type IS NULL) AS notype_closed, | |
+ count(*) FILTER (WHERE NOT is_pr AND type = 'bug' and impact = 'critical') AS bugs_p1_closed, | |
+ count(*) FILTER (WHERE NOT is_pr AND type = 'bug' and impact = 'high') AS bugs_p2_closed, | |
+ count(*) FILTER (WHERE NOT is_pr AND type = 'bug' and impact = 'medium') AS bugs_p3_closed, | |
+ count(*) FILTER (WHERE NOT is_pr AND type = 'bug' and impact = 'low') AS bugs_p4_closed | |
FROM {{ ref('github_issues') }} | |
WHERE closed_at IS NOT NULL | |
GROUP BY 1,2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment