Created
May 15, 2019 03:51
-
-
Save sminnee/abff08772c21dbf39490cb9b46cd7a2b 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 394a156..455f8d9 100644 | |
--- a/ss_dbt/models/platform/github_metrics.sql | |
+++ b/ss_dbt/models/platform/github_metrics.sql | |
@@ -52,10 +52,12 @@ SELECT | |
COALESCE(SUM(notype_closed) OVER (PARTITION BY closed.repository ORDER BY closed.week ASC ROWS BETWEEN unbounded preceding AND CURRENT row), 0) | |
AS notype_total_closed, | |
- SUM(prs_created) OVER (PARTITION BY created.repository ORDER BY created.week ASC ROWS BETWEEN unbounded preceding AND CURRENT row) | |
- - COALESCE(SUM(prs_closed) OVER (PARTITION BY closed.repository ORDER BY closed.week ASC ROWS BETWEEN unbounded preceding AND CURRENT row), 0) | |
+ SUM(COALESCE(prs_created, 0)) OVER (PARTITION BY repos.repository ORDER BY weeks.weeks ASC ROWS BETWEEN unbounded preceding AND CURRENT row) | |
+ AS prs_total_opened, | |
+ SUM(COALESCE(prs_created, 0)) OVER (PARTITION BY repos.repository ORDER BY weeks.weeks ASC ROWS BETWEEN unbounded preceding AND CURRENT row) | |
+ - 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_open, | |
- COALESCE(SUM(prs_closed) OVER (PARTITION BY closed.repository ORDER BY closed.week ASC ROWS BETWEEN unbounded preceding AND CURRENT row), 0) | |
+ 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, | |
gmd.total_triaged, | |
@@ -68,8 +70,8 @@ SELECT | |
FROM ( | |
SELECT generate_series( | |
- date_trunc('week', min(created_at))::timestamp with time zone, | |
- 'now'::text::date::timestamp with time zone, | |
+ date_trunc('week', min(created_at))::timestamp with time zone, | |
+ 'now'::text::date::timestamp with time zone, | |
'7 days'::interval | |
) weeks | |
FROM analytics.github_issues |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment