From 34d572253cf1a485006ac53d16d0a8087a0f6ad6 Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Thu, 23 Aug 2018 10:21:34 -0400 Subject: [PATCH] show open and total counts for import patches Change-Id: Ib1a9b3665b8b8ce175e16baf6d0baee58ab200db Signed-off-by: Doug Hellmann --- goal_tools/python3_first/patches.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/goal_tools/python3_first/patches.py b/goal_tools/python3_first/patches.py index 969e05c..9dd295a 100644 --- a/goal_tools/python3_first/patches.py +++ b/goal_tools/python3_first/patches.py @@ -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)