show open and total counts for import patches

Change-Id: Ib1a9b3665b8b8ce175e16baf6d0baee58ab200db
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2018-08-23 10:21:34 -04:00
parent de6f94b36d
commit 34d572253c
1 changed files with 14 additions and 6 deletions

View File

@ -248,16 +248,24 @@ class PatchesCount(lister.Lister):
gov_dat = governance.Governance(url=parsed_args.project_list)
changes = (
c for c in all_changes(True)
c for c in all_changes(False)
if c.get('subject') == self._import_subject
)
team_counts = collections.Counter()
open_counts = collections.Counter()
for c in changes:
team_counts.update(
{gov_dat.get_repo_owner(c.get('project')) or 'unknown': 1}
)
status = c.get('status')
if status == 'ABANDONED':
continue
item = {gov_dat.get_repo_owner(c.get('project')) or 'other': 1}
team_counts.update(item)
if c.get('status') != 'MERGED':
open_counts.update(item)
columns = ('Team', 'Open')
data = sorted(team_counts.items())
columns = ('Team', 'Open', 'Total')
data = (
(team, open_counts[team], count)
for team, count in sorted(team_counts.items())
)
return (columns, data)