More gracefully handle intra-openstack moves
Splitting a project out into its own team causes problems with the diversity check if the new project is inside of another project. This is because there is no {project}-group stackalytics container, only a {{project}} one. Trap for the 404 error and re-point to {{project}} if {{project}}-group is not found. Change-Id: I68b1b7c4d98810f1d710351e4477fb83ef1fad21
This commit is contained in:
parent
28f210dc43
commit
295f7e581b
@ -125,10 +125,21 @@ def get_diversity_stats(project):
|
||||
team_stats = {}
|
||||
# commits by company
|
||||
group = "%s-group" % project.lower()
|
||||
commits = s.get('http://stackalytics.com/api/'
|
||||
commit_resp = s.get('http://stackalytics.com/api/'
|
||||
'1.0/stats/companies?metric=commits&release=all'
|
||||
'&project_type=all&module=%s&start_date=%s'
|
||||
% (group, six_months)).json()
|
||||
% (group, six_months))
|
||||
if commit_resp.status_code == 404:
|
||||
# The project in question doesn't have a group in stackalytics because
|
||||
# it's part of a different group. Just look for it without the group
|
||||
# suffix (e.g. during shade transition, there is no shade-group because
|
||||
# the shade repo was in infra-group)
|
||||
group = project.lower()
|
||||
commit_resp = s.get('http://stackalytics.com/api/'
|
||||
'1.0/stats/companies?metric=commits&release=all'
|
||||
'&project_type=all&module=%s&start_date=%s'
|
||||
% (group, six_months))
|
||||
commits = commit_resp.json()
|
||||
# reviews by company
|
||||
reviews = s.get('http://stackalytics.com/api/'
|
||||
'1.0/stats/companies?metric=marks&release=all'
|
||||
|
Loading…
Reference in New Issue
Block a user