zhiminy commited on
Commit
b9a2130
·
1 Parent(s): 452bbc0
Files changed (2) hide show
  1. app.py +1 -0
  2. msr.py +5 -1
app.py CHANGED
@@ -182,6 +182,7 @@ def fetch_reviews_from_bigquery(client, identifier, start_date, end_date):
182
  FROM `{table_name}`
183
  WHERE type = 'PullRequestReviewEvent'
184
  AND actor.login = @identifier
 
185
  """)
186
 
187
  query = " UNION ALL ".join(union_parts)
 
182
  FROM `{table_name}`
183
  WHERE type = 'PullRequestReviewEvent'
184
  AND actor.login = @identifier
185
+ AND JSON_EXTRACT_SCALAR(payload, '$.pull_request.url') IS NOT NULL
186
  """)
187
 
188
  query = " UNION ALL ".join(union_parts)
msr.py CHANGED
@@ -178,6 +178,7 @@ def fetch_all_pr_metadata_single_query(client, identifiers, start_date, end_date
178
  WHERE
179
  type = 'PullRequestReviewEvent'
180
  AND actor.login IN ({identifier_list})
 
181
 
182
  UNION ALL
183
 
@@ -195,6 +196,7 @@ def fetch_all_pr_metadata_single_query(client, identifiers, start_date, end_date
195
  type = 'IssueCommentEvent'
196
  AND actor.login IN ({identifier_list})
197
  AND JSON_EXTRACT_SCALAR(payload, '$.issue.pull_request.url') IS NOT NULL
 
198
 
199
  UNION ALL
200
 
@@ -211,6 +213,7 @@ def fetch_all_pr_metadata_single_query(client, identifiers, start_date, end_date
211
  WHERE
212
  type = 'PullRequestReviewCommentEvent'
213
  AND actor.login IN ({identifier_list})
 
214
  ),
215
 
216
  pr_status AS (
@@ -224,9 +227,10 @@ def fetch_all_pr_metadata_single_query(client, identifiers, start_date, end_date
224
  FROM (
225
  {status_tables}
226
  )
227
- WHERE
228
  type = 'PullRequestEvent'
229
  AND JSON_EXTRACT_SCALAR(payload, '$.action') = 'closed'
 
230
  AND JSON_EXTRACT_SCALAR(payload, '$.pull_request.html_url') IN (
231
  SELECT DISTINCT url FROM review_events
232
  )
 
178
  WHERE
179
  type = 'PullRequestReviewEvent'
180
  AND actor.login IN ({identifier_list})
181
+ AND JSON_EXTRACT_SCALAR(payload, '$.pull_request.html_url') IS NOT NULL
182
 
183
  UNION ALL
184
 
 
196
  type = 'IssueCommentEvent'
197
  AND actor.login IN ({identifier_list})
198
  AND JSON_EXTRACT_SCALAR(payload, '$.issue.pull_request.url') IS NOT NULL
199
+ AND JSON_EXTRACT_SCALAR(payload, '$.issue.html_url') IS NOT NULL
200
 
201
  UNION ALL
202
 
 
213
  WHERE
214
  type = 'PullRequestReviewCommentEvent'
215
  AND actor.login IN ({identifier_list})
216
+ AND JSON_EXTRACT_SCALAR(payload, '$.pull_request.html_url') IS NOT NULL
217
  ),
218
 
219
  pr_status AS (
 
227
  FROM (
228
  {status_tables}
229
  )
230
+ WHERE
231
  type = 'PullRequestEvent'
232
  AND JSON_EXTRACT_SCALAR(payload, '$.action') = 'closed'
233
+ AND JSON_EXTRACT_SCALAR(payload, '$.pull_request.html_url') IS NOT NULL
234
  AND JSON_EXTRACT_SCALAR(payload, '$.pull_request.html_url') IN (
235
  SELECT DISTINCT url FROM review_events
236
  )