Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: infra/tools/antibody/code_review_parse.py

Issue 1235373004: Added script to generate stats on a git checkout (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@new_antibody_db_schema
Patch Set: Rebase Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « infra/tools/antibody/cloudsql_connect.py ('k') | infra/tools/antibody/compute_stats.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import datetime 5 import datetime
6 import logging 6 import logging
7 import re 7 import re
8 import requests 8 import requests
9 from simplejson.scanner import JSONDecodeError 9 from simplejson.scanner import JSONDecodeError
10 10
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 db_data_all.append(db_data) 116 db_data_all.append(db_data)
117 elif message['disapproval']: 117 elif message['disapproval']:
118 time_commented = message['date'].split('.')[0] 118 time_commented = message['date'].split('.')[0]
119 db_data = (message['sender'], rietveld_url, time_commented, curr_time, 119 db_data = (message['sender'], rietveld_url, time_commented, curr_time,
120 'not lgtm') 120 'not lgtm')
121 db_data_all.append(db_data) 121 db_data_all.append(db_data)
122 return db_data_all 122 return db_data_all
123 123
124 124
125 def get_tbr_no_lgtm(cc): # pragma: no cover 125 def get_tbr_no_lgtm(cc): # pragma: no cover
126 cc.execute("""Select review.review_url, review.request_timestamp, 126 cc.execute("""SELECT review.review_url, review.request_timestamp,
127 git_commit.hash, commit_people.people_email_address FROM review 127 git_commit.subject, commit_people.people_email_address, git_commit.hash
128 INNER JOIN git_commit on review.review_url = git_commit.review_url 128 FROM review
129 INNER JOIN commit_people on commit_people.git_commit_hash = 129 INNER JOIN git_commit
130 git_commit.hash 130 ON review.review_url = git_commit.review_url
131 LEFT JOIN (SELECT review_url, COUNT(*) AS c FROM review_people 131 INNER JOIN commit_people
132 WHERE type = 'lgtm' GROUP BY review_url) lgtm_count on 132 ON commit_people.git_commit_hash = git_commit.hash
133 review.review_url = lgtm_count.review_url WHERE 133 LEFT JOIN (
134 lgtm_count.c = 0 OR lgtm_count.c IS NULL AND commit_people.type = 134 SELECT review_url, COUNT(*)
135 'tbr'""") 135 AS c
136 return cc.fetchall() 136 FROM review_people
137 WHERE type = 'lgtm'
138 GROUP BY review_url) lgtm_count
139 ON review.review_url = lgtm_count.review_url
140 WHERE lgtm_count.c = 0 OR lgtm_count.c IS NULL
141 AND commit_people.type = 'tbr'""")
142 data_all = cc.fetchall()
143 formatted_data = []
144 for data in data_all:
145 subject = (data[2][:61] + '...') if len(data[2]) > 62 else data[2]
146 formatted_data.append([data[0], data[1].strftime("%Y-%m-%d %H:%M:%S"),
147 subject.replace('-', ' '), data[3], data[4]])
148 return formatted_data
OLDNEW
« no previous file with comments | « infra/tools/antibody/cloudsql_connect.py ('k') | infra/tools/antibody/compute_stats.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698