Use all stats while calculating reviews by company

While obtaining stats for particilar core reviewer teamstats script ignores
the case when person changes company. In this case, "stats" data in responce
obj includes more than one stat, but only first one is taken now.

This patch fixes this issue.

Change-Id: I3a588c0fc742b3e123eb32623315fdf2894ce7c9
This commit is contained in:
Andrey Kurilin 2017-01-19 01:12:34 +02:00
parent 1d361a81f6
commit aca45f3054
1 changed files with 9 additions and 10 deletions

View File

@ -102,17 +102,16 @@ def get_core_reviews_by_company(group):
for eng in reviews['stats']:
if eng['core'] != 'master':
continue
company = s.get('http://stackalytics.com/api/1.0/'
'stats/companies?metric=marks&'
'module=%s&user_id=%s&project_type=all'
'&release=all&start_date=%s'
% (group, eng['id'],
six_months)).json()['stats'][0]['id']
companies.setdefault(company, {'reviewers': 0, 'reviews': 0})
for stat in s.get('http://stackalytics.com/api/1.0/stats/'
'companies?metric=marks&module=%s&user_id=%s&'
'project_type=all&release=all&start_date=%s' %
(group, eng['id'], six_months)).json()['stats']:
company = stat['id']
companies.setdefault(company, {'reviewers': 0, 'reviews': 0})
if eng['metric'] >= MIN_REVIEWS or eng['metric'] >= min_percent:
companies[company]['reviews'] += eng['metric']
companies[company]['reviewers'] += 1
if eng['metric'] >= MIN_REVIEWS or eng['metric'] >= min_percent:
companies[company]['reviews'] += stat['metric']
companies[company]['reviewers'] += 1
return companies