diff --git a/metrics/github/api.py b/metrics/github/api.py index df1e6440..d2e18673 100644 --- a/metrics/github/api.py +++ b/metrics/github/api.py @@ -153,8 +153,8 @@ def prs_open_in_range(org, start, end): return list(_iter_pull_requests(org, date_range)) -def prs_closed_on_date(org, date): - query = f"closed:{date}" +def prs_merged_on_date(org, date): + query = f"merged:{date}" return list(_iter_pull_requests(org, query)) diff --git a/metrics/github/backfill.py b/metrics/github/backfill.py index a3d07667..a468aa76 100644 --- a/metrics/github/backfill.py +++ b/metrics/github/backfill.py @@ -40,6 +40,7 @@ def get_prs(db): SELECT date(pull_requests.created_at) as created, date(pull_requests.closed_at) as closed, + date(pull_requests.merged_at) as merged, authors.login as author, repos.name as repo, owners.login as org @@ -108,11 +109,11 @@ def pr_throughput(prs, org): log.info("%s | %s | Processing %s opened PRs", day, org, len(opened_prs)) process_prs(writer, opened_prs, day, name="prs_opened") - closed_prs = [ - pr for pr in prs if pr["closed"] and date_from_iso(pr["closed"]) == day + merged_prs = [ + pr for pr in prs if pr["merged"] and date_from_iso(pr["merged"]) == day ] - log.info("%s | %s | Processing %s closed PRs", day, org, len(closed_prs)) - process_prs(writer, closed_prs, day, name="prs_closed") + log.info("%s | %s | Processing %s merged PRs", day, org, len(merged_prs)) + process_prs(writer, merged_prs, day, name="prs_merged") @click.command() diff --git a/metrics/github/cli.py b/metrics/github/cli.py index acb5f99b..aaf7cb7b 100644 --- a/metrics/github/cli.py +++ b/metrics/github/cli.py @@ -72,9 +72,9 @@ def pr_throughput(ctx, org, date): log.info("%s | %s | Processing %s opened PRs", date, org, len(opened_prs)) process_prs(writer, opened_prs, date, name="prs_opened") - closed_prs = api.prs_closed_on_date(org, date) - log.info("%s | %s | Processing %s closed PRs", date, org, len(closed_prs)) - process_prs(writer, closed_prs, date, name="prs_closed") + merged_prs = api.prs_merged_on_date(org, date) + log.info("%s | %s | Processing %s merged PRs", date, org, len(merged_prs)) + process_prs(writer, merged_prs, date, name="prs_merged") github.add_command(backfill)